A moving average (rolling or running average) is a calculation to analyze data points by creating a series of averages of different subsets of the full data set. 

Here we see 3 examples of the analysis of time series. 

  • The first series is just an analysis by week.  No moving average is applies.
  • In the second series you'll see a 4 weeks moving average applied. Week 15 will appear as a first data point, because with 4 week moving average, you need 4 weeks of data. The second data point is week 16 and will contain data of week 12 till week 15.
  • in the third series you'll see it is showing a 4 week moving average, but with the setting to still show the data points before (but based on the existing weeks only)

It's important to keep in mind that weeks or months with a larger base size will have a stronger impact on the result. If you for example have a base of 10 000 one month and 100 the next, the results for the first month is weighting 100 times more.

Below an example of this calculation to get to 74%, which is the rolling average of the 3 months:

Base size n113143164420
Result in % 76%99%51%74%

The shares of the months are

April 113/420 = 0.269

May 143/420 = 0.340

June 164/420 = 0.390

To calculate the result of the rolling average the month result will be multiplied with the share of the total base size

April 76% * 0.269 = 20.44

May 99% * 0.340 = 33.66

April 51% * 0.390 = 19.89

The sum of those values is 74%