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
Anonymous
Not applicable

Remove All Rows With Duplicates

Hi,

How can I use Power Query to remove any rows that have a duplicate entry, rather than just removing one of the duplicates? So this:

Column

1

2
2
3
5

Would become this:

Column

1

3
5

 

Thanks

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

As is suggested by @HotChilli . I created data to reproduce your scenario.

d1.png

 

You may go to 'Transform' ribbon, click 'Group by', set as follows.

d2.PNG

 

Then you may right-click 'Gouped Rows', click 'Insert Step After', input the formula

 

 

=Table.SelectRows(#"Grouped Rows",each Table.RowCount([Data]) = 1)

 

 

d3.png

d4.png

 

Finally you need to expand the 'Data' table and get the result.

d7.png

d6.PNG

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

As is suggested by @HotChilli . I created data to reproduce your scenario.

d1.png

 

You may go to 'Transform' ribbon, click 'Group by', set as follows.

d2.PNG

 

Then you may right-click 'Gouped Rows', click 'Insert Step After', input the formula

 

 

=Table.SelectRows(#"Grouped Rows",each Table.RowCount([Data]) = 1)

 

 

d3.png

d4.png

 

Finally you need to expand the 'Data' table and get the result.

d7.png

d6.PNG

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

Yep, I'm with @HotChilli on this one. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

How do you do that without losing all the other columns?

What other columns?

 

OK , using 'advanced' in the Group By step,  add another aggregation -> at the bottom of the Operation list is All rows. 

After filtering out the unwanted rows,   expand the All rows column

Anonymous
Not applicable

@HotChilli

Thank you for your help. Here's what I mean:

I have 51 columns in my table:

Annotation 2020-03-05 162743.png

Document No is the column I want to get rid of duplicates on. If I group by on it:

Annotation 2020-03-05 162932.png

It removes all the other columns:

Annotation 2020-03-05 163039.png

I need this Count column, but I need all the other columns as well.

Sorry if I'm missing something basic.

Also, ignore the fact that I'm currently doing this in excel for now, it's the same thing in Power BI

I knew what you meant, I was just being cheeky because you didn't mention the other columns in the original post.

You are on the right 'Group By' dialog, just follow my instructions from my previous post.

Let me know how you get on.

HotChilli
Community Champion
Community Champion

What about performing a 'Group By' Column, with a Count.

Then select out any rows where Count > 1

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.