The problem I have is showing the avg 12 mnth and the avg last mnth as columns. They can be interpreted as 30 and 360 days, like this:
MA 30 =
AverageX(
DATESINPERIOD(
'mart DimCalendarDaily'[CalendarDailyKey];
LASTDATE('mart DimCalendarDaily'[CalendarDailyKey]);
-30;
DAY);
[Waste Water actual])
My problem is that it only works in a table, where the context is a date column.
What I wanted to do was to calculate 9 measures and show them as a column: Like MA 30, MA 360, Today - 6, Today -5, …Today.
Any idea how to solve the above?
Moving Average Results =
VAR MA = SELECTEDVALUE( 'Moving Average Axis'[Moving Average] )
RETURN
SWITCH( TRUE(),
MA = "30 Day MA", [Sales 30D MA],
MA = "360 Day MA", [Sales 360D MA],
BLANK() )
Add it to the table
Then turn to a visualization
So this is really the technique to use here
See how you go with this and let me know how you go
Thanks Sam, it is a very elegant solution and easy to implement. The only change to your solution is that instead of letting the user choose a period I just always choose this week as a relative selection and then hide it from the user.