Forum Discussion

Micha3lS's avatar
Micha3lS
Helper I
4 years ago
Solved

Moving Average

Hello I have the following data:

For the visualisation the OEE data will be shown by Produktgroup in a Linechart. Now i want to add a moving average for each of the 3 productgroups. I tried adding a calculated Column and  tired doing it with a measure but each time i cant add the moving average to the chart.

 



Here is the code i tried: 

 

 

Moving Average = 
		AVERAGEX(
			DATESINPERIOD(
				'OEE nach Linie'[Buchungsdatum],
				LASTDATE('OEE nach Linie'[Buchungsdatum]),
				 - 14 , 
				 DAY),
			CALCULATE(sum('OEE nach Linie'[OEE nach Linie]))
			)

 

 

 

I would appreciate some help, im new to Power BI

Thanks in advance

  • Micha3lS , You can create a measure like

     

    Moving Average =
    AVERAGEX(values('OEE nach Linie'[productgroups])
    ,
    CALCULATE(sum('OEE nach Linie'[OEE nach Linie]),DATESINPERIOD(
    'OEE nach Linie'[Buchungsdatum],
    LASTDATE('OEE nach Linie'[Buchungsdatum])
    - 14 ,
    DAY))
    )

     

    Seem like this scatter visual, Go and add constant line, in new version there is Fx, click on that and take this measure)

1 Reply

  • Micha3lS , You can create a measure like

     

    Moving Average =
    AVERAGEX(values('OEE nach Linie'[productgroups])
    ,
    CALCULATE(sum('OEE nach Linie'[OEE nach Linie]),DATESINPERIOD(
    'OEE nach Linie'[Buchungsdatum],
    LASTDATE('OEE nach Linie'[Buchungsdatum])
    - 14 ,
    DAY))
    )

     

    Seem like this scatter visual, Go and add constant line, in new version there is Fx, click on that and take this measure)