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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
socalkid
New Member

Need help constructing a basic 3, 6, and 12 month moving average

Hello all,

I have a question re: how to calculcate a moving 3 month, 6 month and 12 month average for some headcount data. My main data table looks like this: 

 

socalkid_0-1680994604597.png

 

So I have the count by date, department, work category and location. My goal is to be able to set up a table where I can see the 3-month, 6-month, and 12-month averages for each location, department, work category and then sum up this average if I need to. For example, I'd like to be able to see the overall 3-month average for all of Operations in Shanghai for August 2020. Is this possible? I've been reading about setting up a date table but I'm not sure if that's required for this. Thank you in advance.

1 REPLY 1
amitchandak
Super User
Super User

@socalkid , Try like

 


3 Month Avg = CALCULATE(AverageX(Values('department'[department]),calculate(Sum('Table'[Value)))
,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

 

6 Month Avg = CALCULATE(AverageX(Values('department'[department]),calculate(Sum('Table'[Value)))
,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-6,MONTH))

 


6 Month Avg = CALCULATE(AverageX(Values('Date'[MONTH Year]),calculate(Sum('Table'[Value)))
,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-6,MONTH))

 


3 Month Avg = CALCULATE(AverageX(Values('Date'[MONTH Year]),calculate(Sum('Table'[Value)))
,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

 

Rolling Months Formula: https://youtu.be/GS5O4G81fww

 

Average of Rolling, Average of Snapshots: https://youtu.be/_pZRdLAJxxA

 

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.