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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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 

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.

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 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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