Forum Discussion
Fusilier
1 year agoHelper III
Replace 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]))
)
Bibiano_Geraldo
1 year agoSuper 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