Forum Discussion

EvanWright's avatar
EvanWright
Regular Visitor
9 years ago
Solved

Moving Average Measure

Hello,   I need help with a Moving Average. I have read through many of the other messages, but I can't seem to get this one to work. I need to know the moving average of the Count by Steam,Target ...
  • Phil_Seamark's avatar
    9 years ago

    Try this measure.  I've assumed your table is called 'Stream' and this calculates for 3 weeks (the -21 days)

     

    Moving Average = 
    		AVERAGEX(
    			DATESINPERIOD(
    				'Stream'[WeekStart],
    				LASTDATE('Stream'[WeekStart]) ,
    				 -21 , 
    				 DAY),
    			CALCULATE(sum('Stream'[Count]))
    			)