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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
lbrown
Helper I
Helper I

Dax or Power Query (M) Formula for duplicate values in the same column

If anyone could help me write a dax or power query formula for the two steps below I would greatly appreciate your knowledge.

 

1. If Column A has a duplicate value, and the value in Column B is the same, then return the record with the most recent date.

 

2. If Column A has a duplicate value, and the value in Column B is NOT the same, then keep both records.

 

I'm trying to achieve one formula that can account for both requirements. I've attached images of sample data to better explain. sample 2.PNGsample.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@lbrown,

Could you please explain that why you have duplicate values for first row? I make a test using the following sample table instead, and create a measure in the table.

maxdate = MAX(Table[Date])

1.PNG2.PNG


Regards,
Lydia

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@lbrown,

Could you please explain that why you have duplicate values for first row? I make a test using the following sample table instead, and create a measure in the table.

maxdate = MAX(Table[Date])

1.PNG2.PNG


Regards,
Lydia

@Anonymous

 

I figured out the error. I was adding the table date column instead of maxdate. Your answer worked perfectly, thank you!

@Anonymous
There are duplicates because an entry can be made on the spreadsheet on different days. I am needing to select the most recent date if Column B is the same. If Column B is different then I need to keep both rows.
 
After creating the measure I am still seeing duplicates.
 
maxdate.PNG

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Kudoed Authors