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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

DAX Calculation: Get the date of the previous occurrence of some value

Here's the basic problem I'm trying to solve.  

 

Some song is to be performed at some upcoming date, I and I want to calculate the previous date the song was performed.  I came up with a simple plan.  Get the most recent performance of the song with MAX([date]) and then calculate a new Max([date]) on a set where the first value has been filtered out. 

 

SecondMostRecentPerformanceDate =

Var MaxPlanDate = CALCULATE(Max(Plans[PlanDate]), All(Plans[PlanDate]))

Return
  CALCULATE(
    MAX( Plans[PlanDate] )
   ,Plans[PlanDate] < MaxPlanDate
)   

 

Although I've confirmed that MaxPlanDate has the expected value, the CALCULATE() function is returning blanks. What am I missing here? 

1 REPLY 1
Anonymous
Not applicable

@Anonymous,

I create a measure using your DAX formula, and it returns expected result.

1.PNG

Regards,
Lydia

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