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

How to calculate measure for months -12 to -24 (based on max selected date on filter)

Hi,

 

I have 2 measures, where depending on the date filters selected, I show:

 

Last 12 months:

CALCULATE

(

[Xyz] , DATESINPERIOD (  'Date'[Date] ,  MAX('Date'[Date]) ,  -12 ,  MONTH  )

)

 

 

I need to do the same, but for months -12 to -24.

 

I have tried, but DATEADD doesn’t seem to work with MAX…

 

var dat = MAX('Date'[Date])



RETURN

CALCULATE

(

    [Xyz] ,

    DATESINPERIOD(

            'Date'[Date],   

            DATEADD(dat,-12,MONTH)    ,-24,MONTH)



)

 

 

How can I make the period from -12 to  -24 ?

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try like

 

Rolling 12 till last 12 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],maxX(Sales, dateadd(Sales[Sales Date],-12,month)),-12,MONTH))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.