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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Date Comparison Rolling X months to previous period

I need to do a rolling 3, 6, and 12 month average that compares to the previous period of same length.  This would mean last 3 months compared to 3 months before, last 6 months compared to the 6 months before, etc.

I have tried using the ParallelPeriod function in DAX, but wasn't able to figure it out entirely.

 

What series of DAX formulas would I need to compare the last 3 completed months with the 3 completed onths before?  Once that logic is set, I can apply to the other time periods.

 

Thanks!

 
 
1 ACCEPTED SOLUTION

Hi, @TakeoffGoatMigo 

You just need to modified the 'start date' in function "DATESINPERIOD" .

New measure:

Rolling Average 3 months before = 
CALCULATE (
    SUM ( financials[Sales] ),
    DATESINPERIOD ( 'Calendar'[Date],EDATE( MAX ( 'Calendar'[Date] ),-3), -3, MONTH )
) / 3

veasonfmsft_0-1669361977625.png

Please check my attached pbix for more details.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @TakeoffGoatMigo 

Make sure you have a calendar table, then you can try formula like:

Rolling Average =
CALCULATE (
    SUM ( Sheet1[Sales] ),
    DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), -3, MONTH )
) / 3

Best Regards,
Community Support Team _ Eason

 

This is what I had for the past 3 months, but how do I get the 3 months before that to compare to? 

Thank you!

Hi, @TakeoffGoatMigo 

You just need to modified the 'start date' in function "DATESINPERIOD" .

New measure:

Rolling Average 3 months before = 
CALCULATE (
    SUM ( financials[Sales] ),
    DATESINPERIOD ( 'Calendar'[Date],EDATE( MAX ( 'Calendar'[Date] ),-3), -3, MONTH )
) / 3

veasonfmsft_0-1669361977625.png

Please check my attached pbix for more details.

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.