A moving average smooths out high-frequency fluctuations and seasonal spikes to illuminate the true trajectory of time-series data.
How a rolling window works
Instead of computing a single global average for an entire history, you define a fixed window size (for example, 7 days). You compute the average of the most recent 7 days, and as each new day occurs, the oldest day drops out and the new day enters the window.
SMA = (p₁ + p₂ + ... + pₖ) ÷ k
Practical application in daily sales
Consider daily restaurant revenue across 5 days: Monday: $1,200, Tuesday: $1,400, Wednesday: $900, Thursday: $2,100, Friday: $2,800.
A 3-day moving average:
• Wednesday: ($1,200 + $1,400 + $900) ÷ 3 = $1,166.67
• Thursday: ($1,400 + $900 + $2,100) ÷ 3 = $1,466.67
• Friday: ($900 + $2,100 + $2,800) ÷ 3 = $1,933.33
The moving average dampens Wednesday’s random dip and shows strong upward weekend momentum.
Selecting the optimal window size
• Short windows (3–10 periods): Quick to react to real shifts, but retains more noise.
• Long windows (50–200 periods): Extremely smooth and robust for macro trends, but suffers from lag.
Try it yourself
Open the related calculator to explore your own example, or browse all calculators.