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
SK77
New Member

DAX to Identify earliest date amongst common rows

Hello 

 

I am trying to create a DAX formula that creates a new collumn that for any duplicate set of ID numbers identifes with 'Yes' the row that has the earliest date and a 'no' for all the others. Example of end result I am after is: 

 

IDDate*New Collumn*
A01/01/2024Yes
A02/01/2024No
B01/01/2023Yes
B02/01/2023No
C01/01/2024Yes

 

I appreciate any help!

 

Thanks 

1 ACCEPTED SOLUTION

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1712585015009.png

 

 

Expected result CC = 
VAR _earliest =
    MINX (
        INDEX (
            1,
            SUMMARIZE(Data, Data[ID], Data[Date]),
            ORDERBY ( Data[Date], ASC ),
            ,
            PARTITIONBY ( Data[ID] ),
            MATCHBY ( Data[ID], Data[Date] )
        ),
        Data[Date]
    )
RETURN
    IF ( Data[Date] = _earliest, "Yes", "No" )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

Jihwan_Kim_0-1712292359298.png

 

INDEX function (DAX) - DAX | Microsoft Learn

 

Expected result CC =
VAR _earliest =
    MINX (
        INDEX (
            1,
            Data,
            ORDERBY ( Data[Date], ASC ),
            ,
            PARTITIONBY ( Data[ID] ),
            MATCHBY ( Data[ID], Data[Date] )
        ),
        Data[Date]
    )
RETURN
    IF ( Data[Date] = _earliest, "Yes", "No" )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you! nearly there. But is there away to have this work with duplicates? Whereby any duplicate is identified with a 'yes'. Example:

 

IDDateExpected result CC
A1/1/24Yes
A1/1/24Yes
A1/1/25No
B1/2/23Yes
B1/2/24No
C1/1/24Yes

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1712585015009.png

 

 

Expected result CC = 
VAR _earliest =
    MINX (
        INDEX (
            1,
            SUMMARIZE(Data, Data[ID], Data[Date]),
            ORDERBY ( Data[Date], ASC ),
            ,
            PARTITIONBY ( Data[ID] ),
            MATCHBY ( Data[ID], Data[Date] )
        ),
        Data[Date]
    )
RETURN
    IF ( Data[Date] = _earliest, "Yes", "No" )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Perfect! thank you very much 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.