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
JustinDoh1
Post Prodigy
Post Prodigy

How to get the Value based on MAX(date) - using variable

This is set of data, and I am trying to express my filters in a measure.

JustinDoh1_1-1629938541324.png

I have a data that have two Steps (1 & 2) and different dates (ConsentDate).

I am trying to determine the final outcome (either 1 or 0 depending on Step and ConsentDate).

 

1st: Look for latest date (considering NULL data) for each Step (1 or 2):

In this case, for Step =1, the output of Consent for latest ConsentDate is "Consented", it will select "Consented."

For Step=2, the  the output of Consent for latest ConsentDate (as there is no other date to compare) is "Refused", so it will select "Refused".

 

2nd: Output:

If output for Step 1 is "Consented" or "Historical", output for [StepOne] = 1. 

If output for Step 1 is "Refused", output for [StepOne] = 0. 

 

If output for Step 2 is "Consented" or "Historical", output for [StepTwo] = 1.

If output for Step 2 is "Refused", output for [StepTwo] = 0.

 

I am stuck on this area 1st logic where I need to express:

Find the [Consent] in Step1 where [ConsentDate] is MAX.

Like in SQL: Select [Consent] from Step1 having MAX[ConsentDate] 

 

JustinDoh1_0-1629997718317.png

I am sharing my Pbix file here.

The measure is called "Step1_DEV".   

 

Appreciated for help.

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@JustinDoh1 See if Lookup Min/Max helps: Lookup Min/Max - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@JustinDoh1 See if Lookup Min/Max helps: Lookup Min/Max - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thank you so much. I will dig in more. 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.