37 - Removing duplicates ignores your sort order (Power Query)

Published: 31 July 2023
on channel: WesleySon
358
5

4 methods to remove duplicates while maintaining your sort order.
If you simply add a sorting step right before removing duplicates, that new sort order is ignored.

Method 1: Add a new column (e.g. 1 in each row) immediately before you sort. I don't know why it works (❁´◡`❁)
Method 2: Wrap the table in Table.Buffer before you remove duplicates. This loads the table into memory, which will possibly be slower
Method 3: Group By with adding a new column. Yeah, this method is a waste.
Method 4: Use Group By with Table.Max or Table.Min. This way you sort each individual mini-table, then grab the highest/smallest value. I don't know if this will be slower or faster - you're sorting each view (mini-table), but each view is also smaller.

I would use method 1 even though I don't know why it works, or method 2 if you want to reduce the number of steps.

00:00 - Intro
01:43 - Add a new column before sort
02:12 - Wrap table in Table.Buffer
03:24 - Group By (with a new column...)
05:52 - Group By & Table.Max
08:14 - Using Table.Repeat to time queries
09:28 - My preference (is method 1)


Watch video 37 - Removing duplicates ignores your sort order (Power Query) online without registration, duration hours minute second in high quality. This video was added by user WesleySon 31 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 358 once and liked it 5 people.