Forum Discussion
Moving Averages - DAX and Power BI
- 3 years ago
mzs1988 , Try a meausre like
calculate(averageX(Values('Query1'[device_id]) , calculate(Sum(Query1[completion_time] ))) , DATESINPERIOD('Calendar Relative'[Date],max('Calendar Relative'[Date]), -3 , DAY))
Make sure Calendar Relative is marked as date table
mzs1988 , Try a meausre like
calculate(averageX(Values('Query1'[device_id]) , calculate(Sum(Query1[completion_time] ))) , DATESINPERIOD('Calendar Relative'[Date],max('Calendar Relative'[Date]), -3 , DAY))
Make sure Calendar Relative is marked as date table
Hello Again.
I turns out that your Measure does work. The only thing that I had to do was to replace the Date from the data calender with the the actual date in the table , so the measure becomes as follows :
moving =
var maxdate = max(Query1[dt])
return calculate(averageX(Query1,[completion_time] ) , DATESINPERIOD(Query1[dt],maxdate, -7 , DAY))
Which is strange may I say, I did not expect that to work.
On a side note , Once I do this change the summarize function that i posted orignally also works