Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vstefano
Helper I
Helper I

Possible bug in the duplicate function - Power Query

Good morning,

I think I spot a bug in the way the remove duplicate function in Power Query. In case I ask it to be amended.

Very quickly, see example below. I would expect that removing duplicates from colum A would give the first two lines, but it does not.  Somehow the rows considered refer to the Source step and not the last one.

vstefano_1-1742205953452.png

 

1 ACCEPTED SOLUTION
Deku
Super User
Super User

https://learn.microsoft.com/en-us/powerquery-m/table-distinct

For example, you can't assume that the first row with a unique set of column values will remain, and rows further down in the table will be removed. If you want the duplicate removal to behave predictably, first buffer the table using Table.Buffer.

 

You should use group by first two instead and get min/max date to force behaviour. Table.buffer will work but will stop query folding


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

4 REPLIES 4
Deku
Super User
Super User

https://learn.microsoft.com/en-us/powerquery-m/table-distinct

For example, you can't assume that the first row with a unique set of column values will remain, and rows further down in the table will be removed. If you want the duplicate removal to behave predictably, first buffer the table using Table.Buffer.

 

You should use group by first two instead and get min/max date to force behaviour. Table.buffer will work but will stop query folding


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Thank Deku for the solution which I do apreciate.

In my view it is still somehow a bit misleading for an user, as I would expecpt the first row founded to be retained. 

benjaminjrowley
Frequent Visitor

Weird. Not ideal, but you could use Table.Group() with List.Max() as a quick fix until this is fixed.

yes, this is exactly what I did 👍. I use a grouping taking the max, but this is a workaround.

I just wanted to advise about a bug, in order for it to be amended. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.