Forum Discussion
Fusilier
Helper III
1 year agoReplace divide by Average
I have this measure that calculates the previous 12 months by dividing by 12: Rolling 12 Month Total avg = DIVIDE(CALCULATE (SUM ('Observation Type'[Reports]), DATESBETWEEN ('Observation Type'[Mont...
- 1 year ago
Hi Fusilier ,
you need to iterate over the set of those 12 months and take an average of each month’s total:
Instead of Average, try AverageX, like bellow
Rolling 12-Month Avg = VAR LastMth = LASTDATE( 'Observation Type'[Month] ) VAR FirstMth = NEXTDAY( SAMEPERIODLASTYEAR( LastMth ) ) VAR MonthTable = DATESBETWEEN( 'Observation Type'[Month], FirstMth, LastMth ) RETURN AVERAGEX( MonthTable, CALCULATE( SUM( 'Observation Type'[Reports] ) ) )Let me know if this help you.
Thank you
- 1 year ago
Fusilier , Use Averagex
DAX
Rolling 12 Month Total avg 2 =
AVERAGEX(
DATESBETWEEN(
'Observation Type'[Month],
NEXTDAY(SAMEPERIODLASTYEAR(LASTDATE('Observation Type'[Month]))),
LASTDATE('Observation Type'[Month])
),
CALCULATE(SUM('Observation Type'[Reports]))
)
bhanu_gautam
Super User
1 year agoFusilier , Use Averagex
DAX
Rolling 12 Month Total avg 2 =
AVERAGEX(
DATESBETWEEN(
'Observation Type'[Month],
NEXTDAY(SAMEPERIODLASTYEAR(LASTDATE('Observation Type'[Month]))),
LASTDATE('Observation Type'[Month])
),
CALCULATE(SUM('Observation Type'[Reports]))
)