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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.