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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.