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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
JL2007
Frequent Visitor

Rolling Average last 3, 6, 12 months

Hi!

 

I'm trying to do something I feel like should be simple, I'd like to find the rolling average of our bookings for the last 3, 6 and 12 months. I imagine it would be something along this but I don't know what date formula to use in order to look back the 3, 6, and 12 months. any help would be appreciated!

 

6M Bookings HR =
CALCULATE (
    SUM ( 'Bookings'[Contract Direct Labor] ), 'Table of Dates'[Month]) - 6Months/6
1 ACCEPTED SOLUTION

try this @JL2007 

 

measure =
CALCULATE(
    AVERAGEX(
        SUMMARIZE('Date', 'Date'[Year], 'DATE'[month number]),
        CALCULATE(SUM(Bookings[Contract Direct Labor]))
    ),
    DATESINPERIOD(
        'Date'[Date],
        MAX('Date'[Date]),
        -3,
        MONTH
    )
)
Power BI & Microsoft Fabric
PL-300 | DP-600 | DP-700 Certified

View solution in original post

5 REPLIES 5
danextian
Super User
Super User

Hi @JL2007 

 

SQLBI actually has a very good explanation on how to achieve this using DATESINPERIOD and AVERAGEX.

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





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Ashish_Mathur
Super User
Super User

Hi,

Assuming Bookings is a measure that you have already written, write this measure

Rolling 3 months average booking = averagex(Summarize(calculatetable(calendar,datesbetween(calendar[date],edate(min(calendar[date]),-2),max(calendar[date]))),calendar[year],calendar[month name],"A",[bookings]),[A])

To your visual, ensure that you drag Year and Month name from the Calendar table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
techies
Super User
Super User

Hi @JL2007 please try this

 

3M_Bookings_HR =
CALCULATE(
AVERAGEX(
VALUES('Date'[Month Number]),
SUM(Bookings[Contract Direct Labor])
),
DATESINPERIOD(
'Date'[Date],
MAX('Date'[Date]),
-3,
MONTH
)
)

Power BI & Microsoft Fabric
PL-300 | DP-600 | DP-700 Certified

Thanks, it's giving me the total for the last 3 months, and not the average, I'd expect it to be $7,079,700 as the average not $21,239,101 for February

 

JL2007_0-1742596396795.png

 

try this @JL2007 

 

measure =
CALCULATE(
    AVERAGEX(
        SUMMARIZE('Date', 'Date'[Year], 'DATE'[month number]),
        CALCULATE(SUM(Bookings[Contract Direct Labor]))
    ),
    DATESINPERIOD(
        'Date'[Date],
        MAX('Date'[Date]),
        -3,
        MONTH
    )
)
Power BI & Microsoft Fabric
PL-300 | DP-600 | DP-700 Certified

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.