Forum Discussion
Dynamic Rolling Average & Sum based on Slicer Selection
Hello,
Any idea on how a dynamic rolling average and spend be dynamic based on slicers?
I just noticed that the numbers do not change when I use different slicers such as World Area, Commodity, etc.
I have attached here the pbi file.
https://drive.google.com/file/d/1XhnWQcAFO1i15tz-Ukna2TjdFL0UKT_8/view?usp=sharing
Herewith my formula:
jovendeluna21 , With help from the date table, measures like example measure should help
Rolling 30 = calculate(AverageX(Values('Date'[Date]),CALCULATE(sum(Sales[Sales Amount]))),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-30,DAY))
5 Replies
- amitchandak
Super User
jovendeluna21 , With help from the date table, measures like example measure should help
Rolling 30 = calculate(AverageX(Values('Date'[Date]),CALCULATE(sum(Sales[Sales Amount]))),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-30,DAY))
- jovendeluna21
Helper IV
tried this one but giving me incorrect number
Rolling N = calculate(AverageX(Values('Date'[Date]),CALCULATE(sum('AVE PAYMENT TERMS RAW DATA'[TOTAL_SPEND]))),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-[Parameter Value],MONTH))- amitchandak
Super User
jovendeluna21 , For Days Avg
Rolling N = calculate(AverageX(Values('Date'[Date]),CALCULATE(sum('AVE PAYMENT TERMS RAW DATA'[TOTAL_SPEND]))),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-1* [Parameter Value],MONTH))
For Months Avg// Sum till month Avg post that
Rolling N = calculate(AverageX(Values('Date'[Month Year]),CALCULATE(sum('AVE PAYMENT TERMS RAW DATA'[TOTAL_SPEND]))),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-1* [Parameter Value],MONTH))