Skip to content

Moving Average Examples: Calculate Rolling Trends And Simple Forecasts

September 5, 2026 ·
Illustrated Observations And Smoothed Trend Line

A moving average summarizes a series of observations by calculating an average over a window that moves through time. It can help reveal an underlying pattern when individual observations fluctuate. A trailing moving average can also serve as a simple forecasting method, although it may react slowly to a sustained change. The original fictional examples below demonstrate three-period and five-period windows, weighted averages, centered smoothing, missing observations and evaluation against later actual demand.

Quick Answer

Choose a window of consecutive comparable observations, average the values in that window, and advance it one period at a time. For forecasts, use only observations available before the forecast period.

Table Of Contents

What A Moving Average Calculates

The NIST single moving average guidance explains smoothing through averages of successive groups of observations. For a simple moving average, every observation within the selected window has equal weight.

A three-period trailing moving average at period six uses observations from periods four, five and six. When the window advances to period seven, it drops period four and adds period seven. The series therefore changes through a consistent rolling calculation rather than one average calculated for the complete history.

Our behavior over time graph examples show why a time series can reveal patterns that a single average hides. A moving average can complement the original series, but it should not replace the individual observations when those observations contain important events or exceptions.

Define the quantity and time period first. A three-week average of order counts answers a different question from a three-day average. If some periods are longer than others, the simple arithmetic average of their totals may not represent a comparable rate.

Worked Example: Three-Period Moving Average

A fictional independent bookshop records the following weekly counts of requests for special-order books. The counts are illustrative, not actual business records.

WeekRequests
120
226
322
432
528
636
730
840

The first complete three-week trailing window contains weeks one, two and three. Add 20, 26 and 22 to obtain 68, then divide by three. The moving average at week three is approximately 22.67 requests.

At week four, the window contains weeks two, three and four. Its sum is 26 plus 22 plus 32, or 80. Divide by three to obtain approximately 26.67. Continue using the most recent three observations for every subsequent row.

WeekThree-Week WindowMoving Average
320, 26, 2222.67
426, 22, 3226.67
522, 32, 2827.33
632, 28, 3632.00
728, 36, 3031.33
836, 30, 4035.33

The first two weeks do not have enough observations for a complete three-week window. Leave their results undefined unless a clearly documented partial-window convention is used. Mixing partial and full windows without explanation makes the early results difficult to interpret.

The original series and moving average both show an overall increase in the fictional data, but the average changes less abruptly than individual observations. At week seven the raw count falls from 36 to 30, while the moving average falls only from 32 to approximately 31.33.

Calculate Rolling Sums Efficiently

A simple moving average can be calculated by adding the entire window each time. For a fixed-width window, a rolling sum offers another method. At week three the sum is 68. To advance to week four, subtract the outgoing observation of 20 and add the incoming observation of 32. The new sum is 80.

At week five, subtract 26 and add 28 to the previous sum of 80. The new sum is 82. Divide by the fixed window size of three to obtain approximately 27.33.

This method is mathematically equivalent to calculating each full window independently when all values are available and the window definition remains unchanged. It can be useful when a spreadsheet or other calculation processes a long series.

Keep the original values and avoid rounding intermediate averages before using them in later calculations. The rolling sum can preserve the exact integer totals in this example. If each rounded average is reused to reconstruct a sum, small rounding differences may accumulate over many periods.

Our check sheet examples illustrate the value of consistent original observation records. The moving average relies on those records and should not introduce unrecorded values or discard legitimate observations simply to make the trend smoother.

Compare Three-Period And Five-Period Windows

A longer window typically produces more smoothing but responds more slowly to changes. The five-week trailing average first becomes available at week five. The sum of weeks one through five is 128, giving 25.6 requests.

The next five-week windows produce averages of 28.8, 29.6 and 33.2 at weeks six, seven and eight respectively.

WeekThree-Week AverageFive-Week Average
527.3325.60
632.0028.80
731.3329.60
835.3333.20

At week eight the shorter average is closer to the recent higher counts, while the longer average still includes earlier lower observations. This lag can be useful when the goal is to understand a broader trend. It can be less useful if a planning decision needs to respond promptly to a persistent change.

Window selection should reflect the data frequency, the purpose and the relevant variation. A seven-day moving average of daily observations may help summarize a weekly pattern when all days are comparable. A four-week average may be more useful for a different planning question. Neither window automatically removes every seasonal pattern or establishes the best forecast.

Our data stratification examples illustrate how differences among groups can affect a summary. If weekends have a materially different operating arrangement, examine that pattern rather than assume that any smooth series represents a single stable process.

Worked Example: Weighted Moving Average

A weighted moving average assigns different importance to observations within a window. Suppose the bookshop wants the most recent week to receive weight 0.5, the previous week weight 0.3 and the oldest week weight 0.2. The weights sum to one.

At week eight, the three observations from oldest to newest are 36, 30 and 40. Multiply 36 by 0.2, 30 by 0.3 and 40 by 0.5. The contributions are 7.2, nine and 20. Their sum is 36.2 requests.

ObservationValueWeightContribution
Week 6360.27.2
Week 7300.39.0
Week 8400.520.0
Total—1.036.2

The weighted average differs from the simple three-week result of approximately 35.33. The higher weight on the most recent observation makes the result more responsive to the recent increase.

If a team uses raw weights of two, three and five, divide the weighted sum by the total weight of ten. That produces the same result as the normalized weights 0.2, 0.3 and 0.5. Failing to divide by the weight sum would create a different quantity that is not a weighted average.

Weights should be selected according to an explicit purpose or evaluated forecasting design. Choosing weights after seeing the actual outcomes and then reporting the fitted performance as independent forecast accuracy can be misleading.

Distinguish Centered Smoothing From A Trailing Forecast

The NIST centered moving average guidance describes aligning an average with the center of its observation window. For a three-period centered moving average at week four, use weeks three, four and five. Their values are 22, 32 and 28, giving approximately 27.33.

The same three observations appear in the trailing average at week five. The numerical calculation is identical, but the time alignment differs. The centered result is assigned to week four, while the trailing result is assigned to week five.

A centered smoother is useful for retrospective pattern analysis because it uses observations on both sides of its assigned point. It cannot be used directly as a real-time forecast at that center when later observations are not yet available. In the example, week five’s actual count would not have been known at the end of week four.

For even-width windows, centering requires additional attention because the average may initially align between observation periods. An appropriate centering method can be used where justified, but the alignment should be documented. Do not shift a line visually merely to make it appear to anticipate changes.

Worked Example: Generate A One-Period-Ahead Forecast

A trailing moving average can be used as a simple next-period forecast by averaging the latest complete observations available at the forecast origin. At the end of week three, the bookshop could forecast week four using weeks one, two and three. The forecast is approximately 22.67, while the later actual observation is 32.

At the end of week four, the forecast for week five is approximately 26.67. Continue rolling the three-period window forward without including the actual observation for the period being forecast.

Predicted WeekThree-Week ForecastActualAbsolute Error
422.67329.33
526.67281.33
627.33368.67
732.00302.00
831.33408.67

Using the exact unrounded fractions, the absolute errors sum to 30 requests, giving an MAE of six requests. With actual-minus-forecast as the sign convention, the mean signed error is approximately 5.2 requests. The positive bias indicates underforecasting over these five illustrative predictions.

Our forecast accuracy examples explain how to calculate and interpret MAE, RMSE and signed error. Evaluate a moving-average forecast using only information that would have been available at each forecast origin.

The rising pattern in the bookshop data helps explain why the moving-average forecast often underestimates the next observation. A simple trailing average represents recent levels, not a separate model of an increasing trend.

Compare Forecast Windows On Common Periods

Suppose the team wants to compare the three-week forecast with a five-week forecast. The five-week method first issues a complete-window forecast for week six. Therefore a fair direct comparison can use weeks six, seven and eight for both methods.

The five-week predictions are 25.6 for week six, 28.8 for week seven and 29.6 for week eight. Their absolute errors are 10.4, 1.2 and 10.4, giving a mean absolute error of approximately 7.33. The three-week method’s corresponding absolute errors are approximately 8.67, two and 8.67. Their exact sum is approximately 19.33, giving an MAE of approximately 6.44.

The three-week method has a lower MAE over these common three observations. This does not establish that three is the best window for future data. The small fictional series mainly illustrates the comparison. A larger evaluation covering relevant operating conditions would support a more informed selection.

Avoid comparing the three-week method over five evaluated periods with the five-week method over only three periods without noting the difference. The observation sets may contain different forecasting challenges, and the resulting errors may not support a fair ranking.

Handle Missing Observations And Genuine Zeros

A fictional community repair scheduling service records daily accepted requests. One day’s record is unavailable because the observation has not yet been reconciled. Another day has a verified count of zero.

The missing observation and genuine zero represent different conditions. Substituting zero for the missing record can make the moving average artificially low. Excluding the missing period and averaging the remaining values changes the effective window and may obscure its time coverage.

A suitable rule depends on the purpose. The team might leave any incomplete window undefined, use a documented estimate with a separate flag or use a justified available-observation convention. In each case, preserve the original missing status and explain how the calculated series should be interpreted.

Our measurement system analysis examples describe why the suitability and consistency of observation procedures matter. An apparent change in a moving average may reflect a change in measurement coverage rather than a genuine change in the underlying process.

A moving average can also help explain the temporary effect of a single unusual observation. Suppose an otherwise constant series records 20 requests each week, except one week with 50. In a three-week trailing average, each complete window containing that observation has an average of 30. Once the observation leaves the window, the average returns to 20. The smoothed increase persists for three windows even though the raw series has only one high observation. This is a mathematical consequence of the selected window, not evidence of three separate demand increases. A reader should inspect the original series and any relevant event information before drawing conclusions about the duration of the underlying change.

Reusable Moving Average Worksheet

FieldRecord
ObservationDefined Quantity, Unit And Date
FrequencyComparable Time Period
WindowNumber Of Consecutive Periods
MethodSimple, Weighted Or Centered
WeightsDeclared Values And Normalization
AlignmentTrailing, Centered Or Forecast Horizon
Missing DataExplicit Handling Rule
EvaluationComparable Actuals And Error Measures

Plot the original series and the smoothed values together when useful. Keep legitimate unusual events visible and investigate their consequences rather than deleting them just to make the trend look stable.

A moving average is also not a statistical control limit. A smoothed line can help recognize a broad movement, but it does not establish that deviations from the line are unusual under a defined process model. Our histogram examples illustrate a different way to examine variation. Select the analytical method according to the question.

Finally, consider whether the service has a structural change that makes earlier observations less relevant. If the bookshop extends its operating hours, the next few counts may represent a different service capacity. A moving average will initially combine the earlier and later conditions. Record the change and evaluate the new arrangement rather than interpret the transitional average as a stable estimate. When forecasting for a resource decision, examine whether a more appropriate model can account for the changed condition.

The usefulness of smoothing lies in clarifying the data rather than hiding it. Choose a reproducible window, retain the original observations and distinguish retrospective descriptions from predictions that must be made before the outcome occurs.

Frequently Asked Questions

What is a moving average?

An average calculated over successive windows of a time series.

What is a three-period moving average?

The average of three consecutive observations under a stated alignment.

Why use a longer window?

It generally increases smoothing but can reduce responsiveness.

What is a weighted moving average?

An average assigning different normalized weights to observations.

What is a centered moving average?

A smoother aligned to the center of its observation window.

Can centered smoothing be used as a real-time forecast?

Not when it requires future observations unavailable at the forecast origin.

How can a trailing average forecast demand?

Use the latest complete available window to predict the next period.

Should missing data be treated as zero?

Only if zero is actually established; missing observations need a declared rule.

How should window sizes be compared?

Evaluate them on common periods using the same forecast horizon and error measure.

Does a moving average establish process stability?

It smooths observations; stability requires an appropriate separate assessment.

Leave a Reply

Your email address will not be published. Required fields are marked *