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
π₯ 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










