Forum Discussion
Anonymous
6 years agoNot applicable
Issue with calculating 12 months moving average
HI all,
I have this table and please need help.
What I'm battling with is to calcuate a 12 month moving average of the "Net revenue earned" column.
I have tried in the coolumn next to it but not getting the right calcs.
The code I used was from the "new quick measure" which is as follows:
Net Revenue Earned rolling average 3 =
IF(
ISFILTERED('Calendar'[Date]),
ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
VAR __LAST_DATE = ENDOFMONTH('Calendar'[Date].[Date])
VAR __DATE_PERIOD =
DATESBETWEEN(
'Calendar'[Date].[Date],
STARTOFMONTH(DATEADD(__LAST_DATE, -12, MONTH)),
__LAST_DATE
)
RETURN
AVERAGEX(
CALCULATETABLE(
SUMMARIZE(
VALUES('Calendar'),
'Calendar'[Date].[Year],
'Calendar'[Date].[QuarterNo],
'Calendar'[Date].[Quarter],
'Calendar'[Date].[MonthNo],
'Calendar'[Date].[Month]
),
__DATE_PERIOD
),
CALCULATE([Net Revenue Earned], ALL('Calendar'[Date].[Day]))
)
)
Thanks
Anonymous
You may take a look at the post below.
1 Reply
- v-chuncz-msftCommunity Support
Anonymous
You may take a look at the post below.