Power Query Remove Duplicates Keeps the WRONG Record
🔥 Get our brandnew Power Query exercise pack (including the GroupBy method): https://www.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: https://www.xelplus.com/power-query-keep-latest-record/#download 📘 Master Excel Power Query (full course): https://www.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: https://link.xelplus.com/yt-d-newsletter 🔓 Join this channel to get access to perks: https://www.youtube.com/channel/UCJtUOos_MwJa_Ewii-R3cJA/join 🎬 LINKS to related videos: Learn to Automate Everything with Power Query: https://youtu.be/x7mzOYEn0XA You WON'T BELIEVE These 10 HIDDEN Features in Power Query: https://youtu.be/8hjgmJk5RiA 📲 Let’s connect on social: LinkedIn Leila: www.linkedin.com/in/leilagharani LinkedIn XelPlus: https://www.linkedin.com/company/xelplus Instagram: https://www.instagram.com/lgharani #Excel #powerquery
Suggested videos

Stop Building Ugly Excel Dashboards (Do This Instead)
Leila Gharani · 12:11

Power Query for Beginners: Automate Your Excel Work in 25 Mins
Leila Gharani · 27:01

Stop Writing Huge Excel Formulas. (Use ONE DOT Instead)
Leila Gharani · 10:24

How to Use XLOOKUP in Excel (5 Practical Examples)
Leila Gharani · 13:34

Stop Copying Data Between Excel Sheets! (Do This Instead)
Leila Gharani · 10:31

Stop OneDrive From Hijacking Your Desktop and Documents
Leila Gharani · 11:58

The Only VLOOKUP Guide You’ll Ever Need. (No More Errors)
Leila Gharani · 15:15

What Actually IS a Pivot Table?
Leila Gharani · 3:52