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

View all the Fabric Data Days sessions on demand. View schedule

Reply
POSPOS
Post Partisan
Post Partisan

Conditional columns using DAX in Power BI

HI All,

I have a requirement to display a new column based on a two other columns from the same table.

 

Scenario:

For each contract no., look for the minimum 'contract received date' and then display the respective 'contract executed date' in the new column.

 

Sample data:

Contract No.Contract Received dateContract Executed DateNew Column

22

7/7/20224/17/20234/17/2023

22

7/7/20224/17/20234/17/2023

22

8/7/20221/11/20224/17/2023

22

8/7/20221/11/20224/17/2023
2311/4/20237/8/20214/6/2021
2311/4/20237/8/2021 4/6/2021
232/9/20234/6/2021 4/6/2021
232/9/20234/6/2021 4/6/2021
245/8/20211/1/20211/1/2021
245/8/20211/1/20211/1/2021
249/9/20232/2/20221/1/2021
249/9/20232/2/20221/1/2021

 

Could someone please help with the DAX to achieve this result?

 

Thank you

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

and you can try this

DateNew2 = 
VAR t1 = 'Table'[Contract No.]
VAR t2 = ALLEXCEPT( 'Table', 'Table'[Contract No.] )
VAR t3 = CALCULATE( MIN( 'Table'[Contract Received date] ),t2  )
RETURN 
    CALCULATE(MIN('Table'[Contract Executed Date]),t2,
        'Table'[Contract No.] = t1 && 'Table'[Contract Received date] = t3
    )

View solution in original post

5 REPLIES 5
POSPOS
Post Partisan
Post Partisan

@Ahmedx  - thank you, both the solutions worked.

Ahmedx
Super User
Super User

and you can try this

DateNew2 = 
VAR t1 = 'Table'[Contract No.]
VAR t2 = ALLEXCEPT( 'Table', 'Table'[Contract No.] )
VAR t3 = CALCULATE( MIN( 'Table'[Contract Received date] ),t2  )
RETURN 
    CALCULATE(MIN('Table'[Contract Executed Date]),t2,
        'Table'[Contract No.] = t1 && 'Table'[Contract Received date] = t3
    )

sorry you can shorten the code further try this

 

DateNew2 = 
VAR t1 = 'Table'[Contract No.]
VAR t2 = ALLEXCEPT( 'Table', 'Table'[Contract No.] )
VAR t3 = CALCULATE( MIN( 'Table'[Contract Received date] ),t2  )
RETURN 
    CALCULATE(
        MIN('Table'[Contract Executed Date]),t2,
         'Table'[Contract Received date] = t3
    )

 

This worked too! thank you for the solution

Ahmedx
Super User
Super User

pls try this

DateNew = 
VAR t1 = 'Table'[Contract No.]
VAR t2 = CALCULATE( MIN( 'Table'[Contract Received date] ), ALLEXCEPT( 'Table', 'Table'[Contract No.] ) )
RETURN
    MINX(
        FILTER( ALL( 'Table' ), 'Table'[Contract No.] = t1 && 'Table'[Contract Received date] = t2 ),
        'Table'[Contract Executed Date]
    )

Screenshot_2.png

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.

Top Solution Authors
Top Kudoed Authors