Forum Discussion
GeoffreyLou
3 years agoNew Member
Average for N last values ?
Hello, I'm using Power Pivot and I need to compute the average of N last values, here N = 28 and is based on index column. Basically, I want to have the 28 last values from MAX index to (MAX inde...
- 3 years ago
hi GeoffreyLou
i tried with a simplified dataset:
ceated a measure with such code:
AvgLast5DayNewShopper =CALCULATE(AVERAGE(Sweden[NewShoppers]),FILTER(Sweden,Sweden[Index]>MAX(Sweden[Index]) - 5))it worked like this:you can change 5 to 28 in your real case.
FreemanZ
Super User
3 years agohi GeoffreyLou
i tried with a simplified dataset:
ceated a measure with such code:
AvgLast5DayNewShopper =
CALCULATE(
AVERAGE(Sweden[NewShoppers]),
FILTER(
Sweden,
Sweden[Index]>MAX(Sweden[Index]) - 5
)
)
it worked like this:
you can change 5 to 28 in your real case.
GeoffreyLou
3 years agoNew Member
Working like a charm, many thanks !