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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
mehtatanish34
New Member

Rolling Average vs Same last period Rolling average

Hello,

I’m tasked to compare rolling averages of percentage growth over the last 3 months with the same period rolling average of 3 months from the previous year, but I’m having some issues with my DAX calculations. Here are the measures I’ve written, but the results aren’t as expected.
I’d appreciate any help.
Monthly Sales Growth (%) = VAR CurrentMonthSales = [Total Sales]
VAR PreviousMonthSales =CALCULATE([Total Sales],DATEADD(Calendar[Date], -1, MONTH))
RETURN
DIVIDE(CurrentMonthSales - PreviousMonthSales,PreviousMonthSales,0) * 100

Rolling Avg Growth (3 Months) =
AVERAGEX(DATESINPERIOD(Calendar[Date],MIN(Calendar[Date]),-3,MONTH),[Monthly Sales Growth (%)] )

Rolling Avg Growth Last Year (3 Months) =
CALCULATE([Rolling Avg Growth (3 Months)],DATEADD(Calendar[Date], -12, MONTH))

Comparison of Rolling Avg Growth =
VAR CurrentRollingAvg = [Rolling Avg Growth (3 Months)]
VAR PreviousYearRollingAvg = [Rolling Avg Growth Last Year (3 Months)]
RETURN
CurrentRollingAvg - PreviousYearRollingAvg



1 ACCEPTED SOLUTION
Joe_Barry
Super User
Super User

Hi @mehtatanish34 


You can try measure below for the Rolling 3 months, it requires a Year/Month column combination in your Calendar table

 

 

Sales R3M =
VAR NumOfMonths = 3
VAR LastCurrentDate =
    MAX ( 'Calendar'[Date] )
VAR Period =
    DATESINPERIOD ( 'Calendar'[Date], LastCurrentDate, - NumOfMonths, MONTH )
VAR Result =
    CALCULATE (
        AVERAGEX (
            VALUES ( 'Calendar'[Calendar Year Month] ),
            [Total Sales]
        ),
        Period
    )
VAR FirstDateInPeriod = MINX ( Period, 'Calendar'[Date] )
VAR LastDateWithSales = MAX ( Sales[Order Date] ) ///Enter the date that you want to calculate on
RETURN
    IF ( FirstDateInPeriod <= LastDateWithSales, Result )

 

 

To get the previous year, try this

 

Sales R3M PY =
CALCULATE(
  [Sales R3M], 
    DATEADD('Calendar'[Date], -1 , YEAR)

 

For the comparison just keep it simple

 

Sales R3M PY Diff =
[Sales R3M] - [Sales R3M PY]

 

If you are looking Year on Year

 

YoY =
DIVIDE([Sales R3M PY Diff], [Sales R3M P]

 


Kudos to https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


View solution in original post

1 REPLY 1
Joe_Barry
Super User
Super User

Hi @mehtatanish34 


You can try measure below for the Rolling 3 months, it requires a Year/Month column combination in your Calendar table

 

 

Sales R3M =
VAR NumOfMonths = 3
VAR LastCurrentDate =
    MAX ( 'Calendar'[Date] )
VAR Period =
    DATESINPERIOD ( 'Calendar'[Date], LastCurrentDate, - NumOfMonths, MONTH )
VAR Result =
    CALCULATE (
        AVERAGEX (
            VALUES ( 'Calendar'[Calendar Year Month] ),
            [Total Sales]
        ),
        Period
    )
VAR FirstDateInPeriod = MINX ( Period, 'Calendar'[Date] )
VAR LastDateWithSales = MAX ( Sales[Order Date] ) ///Enter the date that you want to calculate on
RETURN
    IF ( FirstDateInPeriod <= LastDateWithSales, Result )

 

 

To get the previous year, try this

 

Sales R3M PY =
CALCULATE(
  [Sales R3M], 
    DATEADD('Calendar'[Date], -1 , YEAR)

 

For the comparison just keep it simple

 

Sales R3M PY Diff =
[Sales R3M] - [Sales R3M PY]

 

If you are looking Year on Year

 

YoY =
DIVIDE([Sales R3M PY Diff], [Sales R3M P]

 


Kudos to https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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