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
Jo_Swinnen
Frequent Visitor

Rolling 6 months with a variable number of months on the x-axis

Hi,

 

I've created several measures in my report to make visualisations with a variable number of months on the x-axis by using a numeric parameter 'number of months'.

For instance: 

Total= CALCULATE(sum([Revenue]),DATESINPERIOD('Dim Date'[Date],MAX('Dim Date'[Date]),-[Number of months],MONTH))
 
By placing a slicer on the month_year in Dim date and a slicer with the numeric parameter and on the x axis I placed a month_year column out of the fact table, the number of months are variable. 
But now I want the rolling 12 months also in this visualisation. 
But I get the same results as the total measure. 
 
I tried two measures:
Total 12 months = CALCULATE([Total], DATESINPERIOD('Dim Date'[Date],max('Dim Date'[Date]),-12,MONTH))
Total 12 months = CALCULATE(CALCULATE([Total],DATESINPERIOD('Dim Date'[Date],max('Dim Date'[Date]),-12,MONTH), DATESINPERIOD('Dim Date'[Date],MAX('Dim Date'[Date]),-[Number of months],MONTH))
 
Can anyone help?
 
Kind regards,
 
Jo 
1 REPLY 1
Anonymous
Not applicable

Hi @Jo_Swinnen ,

You can use the SAMEPERIODLASTYEAR function to calculate the rolling 12 months based on the same period of the previous year. 

Total 12 months = CALCULATE([Total], SAMEPERIODLASTYEAR(‘Dim Date’[Date]))

 

You can use the PARALLELPERIOD function to calculate the rolling 12 months based on a specified number of intervals in the past or future.

Total 12 months = CALCULATE([Total], PARALLELPERIOD(‘Dim Date’[Date], -12, MONTH))

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

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.