Best approach to calculate/aggregate a Moving Average Stock
Hi All,
I am having a challenge on how to calculate a Moving Annual Average Stock in the aggregated levels.
Below some inputs:
Business definition: Total Stock for the past 53 weeks / number of weeks that has stock (moving/rolling week by week)
I have created 2 measures. Assuming a workbook will always contain 52 weeks.
Wp MACount = (tssum(if(BUWpEOIR != 0,1,0), first, current)+ tssum(if(BULyEOIR != 0,1,0), current, last)))
agg type: recalc
Note: This measure will calculate how many weeks there are stock. Not necessarily we can divide by 53 weeks the sum of stocks.
Wp MA Avg Stock = (tssum(BUWpEOIR, first, current) + tssum(BULyEOIR, current, last))/BUWpMACount)