Forum Discussion
Replace divide by Average
I have this measure that calculates the previous 12 months by dividing by 12:
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
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]))
)
2 Replies
- Bibiano_GeraldoSuper User
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
- bhanu_gautamSuper User
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]))
)