Forum Discussion
Practice Assessment Wrong? Power Query Sort and Remove Duplicates
- 1 year ago
Hi Tember,
Sorting and removing the duplicates is in general the correct answer. However, yes, it does not work all the time, and in my opinion, it is ambiguous, too as you stated.
In my projects, I never use this option, I rather go with inner joining with a duplicated version of the table having the max effective date grouped by customer id.
Regards,
Oktay
- 1 year ago
Yeah, the explanation sounds confusing. It could be a bug in the question/answer.
I would check out this blog: https://gorilla.bi/power-query/removing-duplicates/#advanced-techniques
Or write a native SQL query with ROW_NUMBER() PARTITION BY and the M function Value.NativeQuery() to maintain query folding if needed https://blog.crossjoin.co.uk/2021/02/21/query-folding-on-sql-queries-in-power-query-using-value-nativequery-and-enablefoldingtrue/
Yeah, the explanation sounds confusing. It could be a bug in the question/answer.
I would check out this blog: https://gorilla.bi/power-query/removing-duplicates/#advanced-techniques
Or write a native SQL query with ROW_NUMBER() PARTITION BY and the M function Value.NativeQuery() to maintain query folding if needed https://blog.crossjoin.co.uk/2021/02/21/query-folding-on-sql-queries-in-power-query-using-value-nativequery-and-enablefoldingtrue/