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
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
v-yuezhe-msft
Employee
Employee

@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

Community Support Team _ Lydia Zhang
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
v-yuezhe-msft
Employee
Employee

@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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yuezhe-msft

 

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

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
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