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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
M_BAKOUR_95
New Member

Remove duplicates

Hello all
I want to remove duplicates from a table and keep the  row with the most recent date.
For example, when the values between the "bnf_name" and "wife_name" columns match on two different rows, I want to delete the row with the oldest date in the "verification date" column and keep the row with the most recent date.
Or filter to the full table based on the previous condition.
In the picture below, lines 1 and 3 are the same so I want to delete line 3 and keep line 1 because the value of the "verification date" column is newer.
Any Help !

 
 



image.png

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @M_BAKOUR_95 

 

Based on your description, I created data to reproduce your scenario.

Table:

e1.png

 

You may create a calculated table as below.

 

Compare = 
ADDCOLUMNS(
    SUMMARIZE(
        'Table',
        'Table'[bnf_name],
        'Table'[Wife_name]
    ),
    "NewDate",CALCULATE(MAX('Table'[Date]))
)

 

 

Result:

Compare:

e2.png

 

Best Regards

Allan

 

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

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @M_BAKOUR_95 

 

Based on your description, I created data to reproduce your scenario.

Table:

e1.png

 

You may create a calculated table as below.

 

Compare = 
ADDCOLUMNS(
    SUMMARIZE(
        'Table',
        'Table'[bnf_name],
        'Table'[Wife_name]
    ),
    "NewDate",CALCULATE(MAX('Table'[Date]))
)

 

 

Result:

Compare:

e2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Such things should be performed in Power Query, not in DAX. DAX is a Data Analysis Expressions language, not a data mashup engine.

Best
D
amitchandak
Super User
Super User

@M_BAKOUR_95 

You have an option under transform data/ edit queries

https://community.powerbi.com/t5/Desktop/How-to-remove-duplicate-records/td-p/128875

or try

new Table = distinct(Table)

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

@amitchandak 
Thanks, but this method does not work
Because the "compare" table does not appear in the power query and new Table = distinct (Table)
Also, it does not work because the rest of the values in the rest of the columns are different, and I just want to take the date with the latest date between the matching lines with the name and wife

@M_BAKOUR_95 , Seem like you have an ID column

Max Id = maxx(filter(table, table[Name]=earlier(table[Name]) && table[WIFE]=earlier(table[WIFE])
					&& table[Date]>=earlier(table[Date])),Max(Table[ID]))

 

Now filter

new Table = filter(table,table[ID]=table[Max ID])

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.