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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
EWBWEBB
Helper III
Helper III

Remove duplicates based on condition

Hello,

 

I'm trying to establish how I can remove the duplicates from set of data but chose the one to remove based on a condition. 

 

I have a record of people currently off work.

These entries are repeated each month.

I've got power query to sort it all out and return a neat list with a unique identifier of the persons name and the first day they are off. 

 

I want to remove any duplicates so I have a single list, but when one of the duplicates has a return date entered I want to keep that and remove those where the date isn't entered.

 

If there is a duplicate and none have a return date entered then it doesn't matter which one is removed.

 

If there is a duplicate where they both have the same start and return date then it doesn't matter which is removed.

 

Attached is a file that has some sample data and then a 2 additional column I've populated in excel to show if it is a duplicate and then what I would want the decision to be.

 

Hope this makes sense.

 

The below should give you an anonymised sample data

https://we.tl/t-uAGS6a9jQH 

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @EWBWEBB ,

 

I may be oversimplifying this, but can't you just group on [Name] and [FIRST DAY], then add an aggregated column that is MAX of [RESUMED].

 

It gives you this:

BA_Pete_0-1693496637475.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




I'll give this a go - I thought i tried it and it came up with a strange error but I'll need to loop back to it to try it out. 

Thanks

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.