Power Query Remove Duplicates Keeps the WRONG Record @LeilaGharani
Power Query Remove Duplicates Keeps the WRONG Record  @LeilaGharani
Uploaded June 2026 | Updated September 2026, 1 hour ago
πŸ”₯ Get our brandnew Power Query exercise pack (including the GroupBy method): xelplus.com/course/power-query-challenge-pack
Remove duplicates in Power Query, sort by date, keep the latest record. Logical, right? On a large file it can quietly hand you the wrong number, and nothing breaks to tell you.

That's the trap in this video. You sort newest-first, remove duplicates to keep the top row, and the result looks fine. Then you run it on a bigger dataset and the count is wrong. No error. No warning. Just bad data going into your report.

The cause is lazy evaluation. Power Query tries to be efficient and skips the full sort before removing duplicates, so it keeps an older record instead of the most recent one. I'll show you exactly how to spot it, how to check your work against the source, and the one-line fix: wrapping your sort step in Table.Buffer() so the whole table sorts in memory first.

There's also a second method using Group By that doesn't rely on sort order at all. I cover that one in our Power Query exercise pack.

πŸ“‚ Get the practice workbook: xelplus.com/power-query-keep-latest-record/#download
πŸ“˜ Master Excel Power Query (full course): xelplus.com/course/excel-power-query

⏱️ Chapters
00:00 The "Remove Duplicates" Power Query Trap
00:31 The task: finding the latest stock count
02:28 The "logical" way (sort + remove duplicates)
04:10 Checking the result against the CSV
05:03 Why Power Query kept the wrong record
06:10 The fix: Table.Buffer
07:41 A second method: Group By

πŸ“¨ Subscribe to "Between the Sheets" newsletter to stay on top of office tips and Excel hacks: link.xelplus.com/yt-d-newsletter

πŸ”“ Join this channel to get access to perks:
youtube.com/channel/UCJtUOos_MwJa_Ewii-R3cJA/join

🎬 LINKS to related videos:
Learn to Automate Everything with Power Query: youtu.be/x7mzOYEn0XA
You WON'T BELIEVE These 10 HIDDEN Features in Power Query: youtu.be/8hjgmJk5RiA


πŸ“² Let’s connect on social:
LinkedIn Leila: linkedin.com/in/leilagharani
LinkedIn XelPlus: linkedin.com/company/xelplus
Instagram: instagram.com/lgharani

#Excel #powerquery
Power Query Remove Duplicates Keeps the WRONG RecordNew Shortcut to Quickly Search the Menus in Excel #shortsEvery Analyst Should Run This Check on Their Excel ReportUse ChatGPT inside Excel #shortsResize Multiple Images At Once #shortsStop Using COUNTIF! The Better Way to Count in Excel🌍 The Fastest Way to Research Country Data in Excel #shortsA look back to how it all started. Dont wait for perfection.Easy Trick for Sorting Columns in Power Query #shortsDont Use ChatGPT Until You Watch This VideoMake Beautiful Excel Charts Like The Economist (file included)How to freeze a row in Excel (& freeze multiple rows or columns with just one click) #shorts
Leila Gharani |

Power Query Remove Duplicates Keeps the WRONG Record

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER