cancel
Showing results for 
Search instead for 
Did you mean: 
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.



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!
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
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors