Forum Discussion
Moving Average
- 10 years ago
Firstly you need a column of date with full date format. Then you can use calculated measure to get the expected result. Please refer to following steps.
- Create a calculated column for the date.
FullDate = DATE ( 2016, 'Session'[Month of the Year], 1 )
- Create a measure for 3 months moving average. You can change the number of months if you want.
Moving_Average_3_Months = CALCULATE ( AVERAGEX ( 'Session', 'Session'[Sessions] ), DATESINPERIOD ( 'Session'[FullDate], LASTDATE ( 'Session'[FullDate] ), -3, MONTH ) ) - Drag the Line Chart into your canvas as below.
- Create a calculated column for the date.
Firstly you need a column of date with full date format. Then you can use calculated measure to get the expected result. Please refer to following steps.
- Create a calculated column for the date.
FullDate = DATE ( 2016, 'Session'[Month of the Year], 1 )
- Create a measure for 3 months moving average. You can change the number of months if you want.
Moving_Average_3_Months = CALCULATE ( AVERAGEX ( 'Session', 'Session'[Sessions] ), DATESINPERIOD ( 'Session'[FullDate], LASTDATE ( 'Session'[FullDate] ), -3, MONTH ) ) - Drag the Line Chart into your canvas as below.
Hi v-sihou-msft
I'm a new user as well and have hit a snag while calculating moving average for weeks. Firstly, It's a great formula that you've put up for calculating the moving average of -3 months!
But, I'm trying to do the same thing with weeks. I have my raw data in daily entries. I'm trying to get the average per week and then take the moving average among weeks. My moving average interval would be -2 and +2 weeks. How do I do this? (as the datesinperiod function doesn't have the option to mention intervals in weeks!).
Thanks in advance and much appreciated!
Regards,
sshroffm