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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
POSPOS
Post Partisan
Post Partisan

Show the earliest date from multiple dates in new column using DAX

Hi All,

I have a requirement to show a new column based on two other columns. 

Scenario: For every contract number, check for the 'Contract status' where status="Negotiation" and then display the first or the earliest contract status date in new column.
Note: 'Status=Negotiation' will be repeating for each conract no. and we want to show the first occurance date.

Sample data:

Contract No.Contract StatusContract Status Date
22Submitted1/5/2021
22In-Progress1/8/2021
22Negotiation1/15/2021
22Negotiation1/25/2021
22Negotiation1/27/2021
22Approved1/30/2021
23Submitted5/19/2022
23In-Progress5/22/2022
23Negotiation5/27/2022
23Negotiation5/29/2022
23Negotiation5/30/2022
23Approved5/30/2022

 

Expected output:

Contract No.Negotiation StatusFirst Negotiation Status Date
22Negotiation1/15/2021
23Negotiation5/27/2022

 

Could someone please advise on how this can be achieved using DAX as I will have to use this to derive other calculated columns?

 

Thank you.

 

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @POSPOS 
Try the calculated column with dax:

first negotiation = if('Table'[Contract Status]="Negotiation",CALCULATE(min('Table'[Contract Status Date]),ALLEXCEPT('Table','Table'[Contract No.]),'Table'[Contract Status]="Negotiation"))
You can download the sample file from This link 
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
 
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Ahmedx
Super User
Super User

pls try this

m2 = 
VAR _t1 = ALLEXCEPT('Table','Table'[Contract No.])
VAR _t2 = MAX('Table'[Contract Status])="Negotiation"
VAR _Results = CALCULATE(MIN('Table'[Contract Status Date]),_t1,'Table'[Contract Status]="Negotiation")
RETURN IF(_t2,
_Results)

Screenshot_1.png

View solution in original post

3 REPLIES 3
POSPOS
Post Partisan
Post Partisan

Thank you @Ahmedx @Ritaf1983  - Solution provided has worked.

Ahmedx
Super User
Super User

pls try this

m2 = 
VAR _t1 = ALLEXCEPT('Table','Table'[Contract No.])
VAR _t2 = MAX('Table'[Contract Status])="Negotiation"
VAR _Results = CALCULATE(MIN('Table'[Contract Status Date]),_t1,'Table'[Contract Status]="Negotiation")
RETURN IF(_t2,
_Results)

Screenshot_1.png

Ritaf1983
Super User
Super User

Hi @POSPOS 
Try the calculated column with dax:

first negotiation = if('Table'[Contract Status]="Negotiation",CALCULATE(min('Table'[Contract Status Date]),ALLEXCEPT('Table','Table'[Contract No.]),'Table'[Contract Status]="Negotiation"))
You can download the sample file from This link 
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
 
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Solution Authors
Top Kudoed Authors