Greg_Deckler
3 years agoCommunity Champion
Better Rolling Average
Continuing with exploring alternatives to Power BI's default quick measures that don't involve the CALCULATE function, such as Better Running Total, Better Average per Category, Better Weighted Avera...
HirotoStarParks
1 year agoFrequent Visitor
I have adapted your code to work on days:
```dax
DAILY_MOVING_AVERAGE =
// Previous day
VAR _End = MAX(CALENDAR[DATE]) -1
// Date for N months ago
VAR _Start = EDATE(_End, -MONTHLY_MOVING_AVERAGE[MONTHLY_MOVING_AVERAGE Value])
VAR _OutTable =
SUMMARIZE(
// Filter using all of the calendar dimension table
FILTER(ALL(CALENDAR),CALENDAR[DATE]>=_Start && CALENDAR[DATE]<=_End),
CALENDAR[DATE],
"__Value",[SUM_COUNT]
)
RETURN
AVERAGEX(_OutTable,[__Value])
```