Forum Discussion

owlet0214's avatar
owlet0214
Helper I
6 years ago

Moving Average

Hello, 

 

I made a moving average with reference to "https://community.powerbi.com/t5/Desktop/Moving-Average/m-p/43041", but I can't.

I tried other methods, but I couldn't, so I'll consult you.

 

 

My DAX is below.

The table above shows the "fixday" hierarchy.

 

MovingAverage7day2 =
CALCULATE (
AVERAGEX ( 'Table', 'Table'[count] ),
DATESINPERIOD (
'Table'[fixday],
LASTDATE ('Table'[fixday] ),
-7,
day
)

)

 

When I tried with the following formula, only the specified period part was displayed,

but it seems that "SUM" does not work, and "count / 7" are lined up.

 

I don't think that the above formula and the formula below work for the function that aggregates the filtered periods.

 

CALCULATE(
SUM('Table'[count])/7,
FILTER('Table','Table'[count] < DATE(2020,05,16) && 'Table'[count] > DATE(2020,05,10)))
)

 

I need help.

3 Replies