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
AMaxfield
Regular Visitor

Removing duplicates by two columns of data

Hi All

 

I have the folwing data, please see the example looking at the first four rows;

AMaxfield_0-1626177337420.png

I want to be able to remove the duplicate values of "W/Order" value WA00334 lusing "Op No" and "Date".

 

I only want to retain the higest "Op No" e.g. 25 and the latest date e.g. 22/01/20.

 

So a filter that woudl remove linew 1 to 3 and retain 4 and then effectivly the same for all other data in the table.

 

Any help appreciated 

1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

Hi @AMaxfield ,

you must sort by W/Order, Op No and date in descending order. Then use Table.Buffer to keep that sort order.

If you then remove dups on W/Order it will keep only the topmost row.

More reading here: Bug warning for Table.Sort and removing duplicates... - Microsoft Power BI Community

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
AMaxfield
Regular Visitor

Hi Imke

 

I was not aware of Table.Buffer and it all wroked as you suggested, many thanks for your help.

 

Andy

ImkeF
Super User
Super User

Hi @AMaxfield ,

you must sort by W/Order, Op No and date in descending order. Then use Table.Buffer to keep that sort order.

If you then remove dups on W/Order it will keep only the topmost row.

More reading here: Bug warning for Table.Sort and removing duplicates... - Microsoft Power BI Community

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

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.

Top Solution Authors
Top Kudoed Authors