Former Member

### how to calculate 16 days moving average in WEBI

Hi all

I am working on a line chart, on x-axis i got 4 months and on Y-axis i got sales qty.

I need to show 16 days moving average on this 4 months where the begging of the chart is caluclated 16 days before of it and shouldn't be shown in the chart.

I know formula like [measure]Previous[Measure]previous(previous[measure])) but this is for 3 days moving average, any inputs please for finding the previos16 days moving average?

Thanks

10|10000 characters needed characters exceeded

Former Member
Mar 24, 2011 at 02:57 AM

Short version is this:

=(RunningSum([Sales Qty]) - RunningSum(Previous([Sales Qty]; 16))) / 16

Add that as a column in a block with your dates and it'll give you a moving average of 16 days.

So what it does is calculate the running total for your sales quantity. But because you only want the last 16 days, if will subtract all numbers before 16 days ago (which is the running sum of the previous statement with an offset of 16). So that gives you a running sum for the last 16 days, and then divides it by 16, giving you the average.

DG.