Data analytics explains what happened and why. Forecasting uses those patterns, such as trends and seasonal cycles, to estimate what’s likely to happen next. Together they move a business from looking back at reports to planning ahead with numbers it can measure and improve.
Every business makes predictions, whether it calls them forecasts or not. How much stock to order, how many people to schedule, how much cash will come in next quarter: each decision depends on a guess about the future. Forecasting replaces gut feeling with a method you can test, explain, and get better at over time.
This guide explains the four types of analytics, how insights become predictions, the most common forecasting methods and when to use each, how to measure whether a forecast is any good, and a complete hands-on example in Python that you can run with a free sample dataset.
The Four Types of Data Analytics
Analytics is often described as four levels, each answering a harder question:
| Type | Question it answers | Example | Common tools |
|---|---|---|---|
| Descriptive | What happened? | Sales were 716,479 last year, up 14.5% | SQL, Excel, dashboards |
| Diagnostic | Why did it happen? | December is always the biggest month because of holiday demand | Drill-downs, comparisons, correlation |
| Predictive | What’s likely to happen? | We expect about 805,000 in sales next year | Forecasting models, machine learning |
| Prescriptive | What should we do? | Order more inventory in October; staff up for December | Optimization, scenarios, business rules |
Most organizations spend most of their time on the first two. Forecasting is the step into predictive analytics, and it depends on doing the first two well: you can’t predict a pattern you haven’t found.
From Insights to Predictions
A good forecast isn’t a separate project from analysis. It grows out of it:
- Define the decision. What will the forecast be used for, and how far ahead do you need to see? Ordering inventory might need a 3-month forecast by product; budgeting might need a 12-month forecast by region.
- Collect and clean the history. Forecasts are only as good as their data. Fix gaps, duplicates, and one-off errors first. See Data Cleaning with Python Pandas.
- Explore the patterns. Plot the data and look for a trend, seasonality, and unusual events.
- Start with a simple baseline. A naive forecast tells you what “no skill” looks like.
- Try better methods and test them on data the model hasn’t seen.
- Forecast, with a range. Give a likely value and a realistic range around it.
- Monitor and update. Compare forecasts with what actually happens, and refit regularly.
The Building Blocks of a Time Series
Most business forecasting uses a time series: values recorded at regular intervals, such as daily visits or monthly sales. A time series usually combines four parts:
- Trend: the long-term direction, such as steady growth.
- Seasonality: a pattern that repeats on a fixed calendar, such as higher sales every December or lower traffic every weekend.
- Cycles: longer, irregular ups and downs, such as economic conditions.
- Noise: random variation that no model can predict.
A forecasting method’s job is to capture the trend and seasonality and not chase the noise.
Common Forecasting Methods
| Method | How it works | Best for |
|---|---|---|
| Naive | Next value = last value | A baseline to beat |
| Seasonal naive | Next value = same period last year | A baseline for seasonal data |
| Moving average | Average of the last few periods | Stable data without trend or season |
| Linear trend | A straight line through the history | Steady growth, no strong seasonality |
| Exponential smoothing (Holt-Winters) | Weighted averages that adapt to level, trend, and season | Most business data with trend and seasonality |
| ARIMA / SARIMA | Models how each value relates to past values and past errors | Statistical forecasting with more tuning |
| Regression with drivers | Predicts from other variables, like price, promotions, or weather | When you know what drives demand |
| Machine learning | Models such as gradient boosting learn complex patterns from many features | Many related series and lots of data |
More complex isn’t automatically better. Simple methods often perform surprisingly well, and they’re easier to explain. Always compare any method with a baseline. For an introduction to the machine learning side, see Machine Learning for Beginners.
How to Measure Forecast Accuracy
You can’t judge a forecast by how reasonable it looks. Test it with a backtest: hide the most recent data, forecast it from the older data, then compare.
| Metric | What it means | Example |
|---|---|---|
| MAE (mean absolute error) | Average size of the error, in the original units | “Off by 881 per month, on average” |
| MAPE (mean absolute percentage error) | Average error as a percentage | “Off by 1.5%, on average” |
| RMSE (root mean squared error) | Like MAE, but punishes large misses more | Useful when big errors are costly |
MAPE is easy to explain but breaks down when actual values are near zero. Use MAE when values can be small or zero.
Hands-On Example: Forecasting Monthly Sales with Python
This example uses monthly-sales.csv, a sample dataset with 36 months of sales from January 2023 to December 2025. It has steady growth and a holiday peak, like many retail businesses. You’ll need Python with pandas and statsmodels:
pip install pandas statsmodels
New to pandas? Start with Python for Data Analysis: Accessing Your Data.
Step 1: Descriptive and Diagnostic Analysis
First, understand the history: how fast is it growing, and is there seasonality?
import pandas as pd
df = pd.read_csv("monthly-sales.csv", parse_dates=["month"], index_col="month")
df.index.freq = "MS" # monthly data, starting on the first of each month
# Descriptive: totals per year and growth
yearly = df["sales"].groupby(df.index.year).sum()
print(yearly)
print((yearly.pct_change() * 100).round(1))
# Diagnostic: average share of the year for each calendar month
share = df["sales"] / df["sales"].groupby(df.index.year).transform("sum") * 100
print(share.groupby(df.index.month).mean().round(1))
month
2023 533296
2024 625529
2025 716479
Name: sales, dtype: int64
month
2023 NaN
2024 17.3
2025 14.5
Name: sales, dtype: float64
month
1 6.6
2 6.9
3 7.9
4 8.0
5 8.2
6 8.1
7 8.3
8 8.3
9 8.4
10 8.7
11 9.7
12 10.9
Name: sales, dtype: float64
Two insights stand out:
- Trend: sales grew 17.3% in 2024 and 14.5% in 2025. Growth is strong but slowing slightly.
- Seasonality: December brings about 10.9% of the year’s sales and January only 6.6%. A forecast that ignores this will be wrong every winter.
To see these patterns visually, plot the data with the techniques in Python Data Visualization.
Step 2: Backtest Five Methods
Now hold back 2025, forecast it using only 2023 and 2024, and compare each method with what really happened:
import numpy as np
import pandas as pd
from statsmodels.tsa.holtwinters import ExponentialSmoothing
df = pd.read_csv("monthly-sales.csv", parse_dates=["month"], index_col="month")
df.index.freq = "MS"
sales = df["sales"]
train = sales[:"2024-12"] # 2023 and 2024
test = sales["2025-01":] # 2025, held back to check the forecasts
h = len(test)
forecasts = {}
# 1. Naive: every future month equals the last known month
forecasts["Naive"] = np.repeat(train.iloc[-1], h)
# 2. Seasonal naive: each month equals the same month last year
forecasts["Seasonal naive"] = train.iloc[-12:].values
# 3. Moving average: the average of the last 3 months
forecasts["3-month average"] = np.repeat(train.iloc[-3:].mean(), h)
# 4. Linear trend: a straight line through the history
x = np.arange(len(train))
slope, intercept = np.polyfit(x, train.values, 1)
forecasts["Linear trend"] = intercept + slope * np.arange(len(train), len(train) + h)
# 5. Holt-Winters: exponential smoothing with trend and seasonality
model = ExponentialSmoothing(train, trend="add", seasonal="mul", seasonal_periods=12).fit()
forecasts["Holt-Winters"] = model.forecast(h).values
def mae(actual, pred):
return np.mean(np.abs(actual - pred))
def mape(actual, pred):
return np.mean(np.abs((actual - pred) / actual)) * 100
results = pd.DataFrame(
{name: {"MAE": mae(test.values, f), "MAPE %": mape(test.values, f)} for name, f in forecasts.items()}
).T.sort_values("MAE").round(1)
print(results)
MAE MAPE %
Holt-Winters 881.5 1.5
3-month average 5349.1 9.2
Linear trend 6068.6 10.7
Seasonal naive 7579.2 12.6
Naive 9335.4 16.7
What the results show:
- Holt-Winters wins clearly, because it’s the only method that captures both the trend and the seasonality.
- Seasonal naive gets the shape right but misses the growth, so it’s too low every month.
- Linear trend gets the growth right but misses the seasonality.
- Naive is worst: carrying December’s peak forward overshoots January badly.
A 1.5% error is unusually good. This sample data has a clean, consistent pattern; real data has promotions, outages, and surprises, so expect larger errors. What matters is the comparison: a method has to beat the simple baselines to be worth using.
Step 3: Forecast Next Year with a Range
Once you’ve chosen a method, refit it on all the data and forecast forward. This version uses statsmodels’ ETSModel, which is the same kind of model as Holt-Winters but can also calculate prediction intervals:
import numpy as np
import pandas as pd
from statsmodels.tsa.exponential_smoothing.ets import ETSModel
df = pd.read_csv("monthly-sales.csv", parse_dates=["month"], index_col="month")
df.index.freq = "MS"
# Refit on all 36 months, then forecast the next 12
model = ETSModel(df["sales"], error="add", trend="add", seasonal="mul",
seasonal_periods=12).fit(disp=False)
pred = model.get_prediction(start="2026-01-01", end="2026-12-01",
rng=np.random.default_rng(0)) # fixed seed: same results every run
summary = pred.summary_frame(alpha=0.2) # 80% prediction interval
table = summary[["mean", "pi_lower", "pi_upper"]].round(-2).astype(int)
table.index = table.index.strftime("%Y-%m")
print(table)
print("2026 total forecast:", int(round(summary["mean"].sum(), -3)))
mean pi_lower pi_upper
2026-01 53700 51300 56000
2026-02 55700 53200 58200
2026-03 63700 61300 66100
2026-04 65100 62800 67600
2026-05 67100 64800 69600
2026-06 66900 64500 69300
2026-07 67800 65400 70300
2026-08 66400 63800 68900
2026-09 66200 64100 68700
2026-10 69100 66700 71300
2026-11 76500 74000 78800
2026-12 86400 84000 88900
2026 total forecast: 805000
The forecast for 2026 is about 805,000, roughly 12% above 2025, with December around 86,400. The pi_lower and pi_upper columns form an 80% prediction interval: if the model’s assumptions hold, about 8 out of 10 months should land inside that range. The ranges are fairly narrow here because the history is so regular; with noisier data, they’d be much wider.
For this kind of model, statsmodels calculates the intervals by simulating many possible futures. The rng argument fixes the random seed so you get the same numbers every time you run it.
Forecasting Without Code
You don’t need Python to start forecasting:
- Excel: select a date column and a value column and use Data > Forecast Sheet to create a forecast chart with upper and lower bounds. The
FORECAST.ETSfunction uses the same exponential smoothing approach in a formula, andFORECAST.LINEARfits a straight-line trend. See the Excel for Data Analysis series to get comfortable with your data first. - Power BI: line charts with a date axis have a Forecast option in the Analytics pane, with settings for the forecast length, seasonality, and confidence interval. See Power BI 101.
- SQL: you can prepare the history with SQL, such as monthly totals with aggregate functions and date functions, then forecast in Python, Excel, or Power BI.
Presenting Forecasts So People Trust Them
- Always show a range, not just one number. “About 805,000, likely between X and Y” is more honest and more useful than “805,000.”
- Explain the drivers. “Growth continues at about 12%, with the usual holiday peak” is easier to trust than a black box.
- Show the backtest. People trust a forecast more when they can see how well the method did on last year’s data.
- State the assumptions. A forecast assumes the future looks like the past. Note anything that could break that, such as a new competitor, a price change, or a new product line.
- Offer scenarios for big decisions: a base case, a low case, and a high case.
Common Forecasting Mistakes
- Skipping the baseline. If a complex model can’t beat “same month last year,” it isn’t adding value.
- Testing on the training data. A model always looks good on data it has already seen. Backtest on held-out recent data.
- Ignoring seasonality, which produces forecasts that are wrong in a predictable way every year.
- Forecasting too far ahead. Uncertainty grows with the horizon; a 3-year monthly forecast is mostly guesswork.
- Using dirty data. One-off events, like a data outage or a single huge order, distort every method. Clean or flag them first.
- Never updating. Refit regularly and track forecast error over time.
- Treating the forecast as a promise. It’s an estimate with uncertainty, and it should guide decisions, not replace judgment.
Where Forecasting Is Used
- Sales and revenue planning: budgets, targets, and cash flow.
- Inventory and supply chain: how much to order and when.
- Staffing: scheduling for busy and slow periods.
- Website and IT capacity: expected traffic, storage, and server load.
- Finance: expenses, collections, and cash needs.
- Energy and utilities: expected demand by hour, day, or season.
Frequently Asked Questions
What’s the difference between data analytics and forecasting?
Data analytics explains past and current data: what happened and why. Forecasting uses those patterns to estimate future values. Forecasting is one part of predictive analytics.
What are the four types of data analytics?
Descriptive (what happened), diagnostic (why it happened), predictive (what’s likely to happen), and prescriptive (what to do about it).
What is the best forecasting method?
There isn’t one best method. For monthly business data with growth and seasonality, exponential smoothing (Holt-Winters) is a strong, simple starting point. Always compare methods with a backtest and a baseline.
How much historical data do I need?
For seasonal data, at least two full cycles: two years of monthly data for a yearly pattern. More history helps, as long as the business hasn’t changed so much that old data no longer applies.
How do I know if my forecast is accurate?
Backtest it: forecast a recent period you held back, then measure the error with MAE or MAPE, and compare it with a simple baseline like seasonal naive.
Is forecasting the same as machine learning?
Not exactly. Many forecasting methods, such as exponential smoothing and ARIMA, are statistical models. Machine learning can also forecast, especially with many related series and outside variables, but it isn’t required to get good results.
Conclusion
Forecasting is the natural next step after descriptive and diagnostic analytics. Once you understand your data’s trend and seasonality, you can turn those insights into predictions, test them honestly with a backtest, and present them with a realistic range.
Start simple: build a baseline, try exponential smoothing, measure the error, and compare. Download the sample dataset, run the three steps above, then try the same approach on your own data, whether it’s sales, website traffic, or expenses.
