Skip to main content
Copertina articolo: Sales Forecast: From Moving Average to Arima/prophet with Python
Articles/Data Science

Sales Forecast: From Moving Average to Arima/prophet with Python

/

In 2000, Cisco boasted a sales forecasting system considered “the best in the industry.” Based on historical data, regression models and manual inputs from sales managers, that system failed to predict the abrupt turn of the market when, in March 2001, the dot-com bubble exploded. The devaluation of $2.2 billion in inventory in a single quarter was the consequence of a model unable to recognize a regime change.

The problem was not technical, but conceptual: the extrapolate model of the past without considering that the future could be structurally different. From this experience emerges a basic lesson: the forecast is not a prophecy, but an estimate with explicit margins of error and stated assumptions. It serves to improve decisions with respect to uncertainty.

Why forecast counts: decision science

Answer the question “How much will we bill next quarter?” with a number based on statistical methods compared allows you to plan resources, investments and strategies. On the contrary, answer “Boh, hopefully well” means making decisions in the dark.

Amazon Web Services, for example, calibrates quarterly server capacity with demand forecast models. An excess 10% error leads to capital waste, while a 10% default error means lost customers. Even a 2% improvement in accuracy is worth hundreds of millions.

The same principle applies to companies of all sizes: to expect better is a competence that can and must be learned.

Approach 1: moving average, simplicity and robustness

The moving average calculates the average sales of the last N periods to predict the next. It is a method with over a century of history, still used for its robustness and interpretation.

How it works

The forecast for the period t+1 is the average sales for the last N periods:

Forecast(t+1) = Average(Sales of the last N periods)

For example, with monthly sales of 100,000, 120,000, 110,000, 130,000, 125,000, 135,000 euros in the last 6 months, the 3 month average is (130,000 + 125,000 + 135,000) / 3 = 130,000 euros.

The choice of N influences reactivity and stability:, N small (2-3): reacts quickly but is sensitive to outliers, N large (6-12): more stable but slow to catch changes

When to use it

ProsAgainst
Easy to calculate and interpretNo catching trend or seasonality
Quickly implementable in ExcelSlowly reacts to structural changes
Robust to data errorsAll data have the same weight

Suitable for stable business with constant demand and low seasonality.

Approach 2: linear regression, picking up the trend

When sales show a growing or decreasing trend, linear regression estimates a line that describes this trend and projects it into the future.

How it works

Sales = a + b × Time

Where a is the base level and b average growth per period. For example, if b = 5,000, sales grow on average of 5,000 euros per month.

Enhance with explanatory variables

By adding variables such as budget marketing, temperature or working days, multiple regression better explains sales. Walmart, for example, integrates weather forecasts to anticipate seasonal sales.

When to use it

ProsAgainst
Capture trend of growth or declineIt takes on linearity often not real
Easy to explain and interpretIt does not manage seasonality
May include causal variablesOutliers Sensitive

Ideal for business with light trend and low seasonality or as a baseline.

Approach 3: ARIAMA and SARIMA, the industrial standard

For business with trend and seasonality, ARIMA is the reference model. It combines self-gressive components, differentiation for stationaryity and mobile error media. SARIMA adds seasonality.

How it works

  • AR: dependence on past sales, I: removal of trend by stationaryity, MA: correction based on previous errors

When to use it

ProsAgainst
Manages trend and seasonalityRequires long historical data (24+ months)
Provides confidence intervalsMore complex to configure
Interpretable and consolidatedAssuming continuity of the past in the future

Suitable for business with sufficient historical data and seasonal patterns.

Measure accuracy: MAPE and MAEA

To evaluate different models metrics such as MAE (absolute average error) and MAPE (average percentage error). A MAPE between 5-10% is excellent, 10-20% acceptable, above 20% indicates a unreliable model.

Conceptual error: accuracy vs accuracy

A forecast is not an exact number but an estimate with a confidence interval. The false security of a precise point without margin is more dangerous than explicit uncertainty. NASA, for example, uses “cones of uncertainty” in space trajectories.

Conclusion: itering to improve

Predicting the future with absolute precision is impossible. Predicting well enough to make better decisions is possible and measurable. Start with the moving average, switch to regression if there is a trend, scale to SARIMA with more mature data. You don’t need the most complex model, you need the most suitable and honest one on uncertainty.

The discipline of forecasting is the discipline of making decisions under uncertainty, balancing simplicity, interpretation and accuracy.

Learn more about advanced techniques in our module data analysis mathematics.

Related articles

Predicting university drop-out: Italian data analysis
February 28, 20261 min read
Read
Cluster analysis customer segmentation: K-means and DBSCAN
February 28, 20261 min read
Read
Conjoint analysis: pricing and product based on real data
February 28, 20261 min read
Read