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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Remove duplicates based on two columns

Hello,

 

The data from my invoices is collected per invoice line, but i only want to have one line number per invoice. So every invoice number can only have one unique Line number and the rest of the rows can be deleted, if this makes any sense.

 

 

So I want to transform this:

Knipsel.PNG

 

into this:

 

Knipsel.PNG

but ofcourse on a much grander scale.

how can i do this? thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous 

You can only filter the original table to only show 1 line number, but cannot remove roles.

 

There is a workaround that you can create a new table and use it to do calculations and create visuals.

Table 2 = CALCULATETABLE('Table',FILTER('Table',[Line Number]=MIN('Table'[Line Number])))


Paul Zheng _ Community Support Team
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

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , In power query you use remove duplicates.

https://www.youtube.com/watch?v=Hc5bIXkpGVE

 

In dax

Table = distinct(Table)

Table = distinct(All(Table[Invoice Numer], Table[Line inumber Invoice]))

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak  thanks for your reply, but I dont want to remove every duplicate I just want Every invoice number to have one unique Line number. So Invoice number 500012 can only have one unique value but it doesnt matter that this unique value has duplicates. so in the example below the invoice has 3 unique line numbers but I only want 1 of them and the rest can be deleted.

 

so this:

Knipsel.PNG

 

Becomes this:

Knipsel1.PNG

 

Any idea how to achieve this?

Anonymous
Not applicable

@Anonymous 

You can only filter the original table to only show 1 line number, but cannot remove roles.

 

There is a workaround that you can create a new table and use it to do calculations and create visuals.

Table 2 = CALCULATETABLE('Table',FILTER('Table',[Line Number]=MIN('Table'[Line Number])))


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors