There is one slide that turns up in almost every planning meeting: “forecast accuracy: 92%”. Lukewarm applause. Next item. But nobody asks which version of the forecast produced that 92%, when that version was frozen, or what is left of the number once you break it down by product. A well-built QlikSense forecast accuracy model answers all three questions on the same screen, and in passing it pulls the floor out from under the comfortable conversation. Because the company average almost always looks fine. The detail, almost never.

The industry numbers help size the problem. The average company lives with somewhere between 20% and 50% inaccuracy in its forecast, according to the benchmarks ketteQ publishes. The cost, moreover, is not theoretical. Stockouts eat between two and five per cent of annual revenue in retail and consumer goods. Overstock, in turn, absorbs between twenty and thirty per cent of working capital. Two opposite errors, the same bank account.
The 92% nobody audits
The real problem is not that the forecast misses. It always will. The problem is that the usual way of measuring it is built, without anyone meaning to, so the result looks acceptable. Three vices repeat in every company where I have set this up.
First, the forecast is compared against its own latest revision. That is, against the version adjusted two weeks ago, when the month was already visible on the horizon. That does not measure the ability to anticipate; it measures the ability to correct at the last minute. Second, it is measured in aggregate. If one plant over-forecasts by a thousand units and another falls short by a thousand, the company closes at zero and the report looks spotless, even though both warehouses are in trouble. Third, the absolute error gets measured and the sign never does. And the sign is exactly what decides whether the money went into dead inventory or into lost sales.
QlikSense forecast accuracy is measured against the frozen version
The conceptual fix is simple, although it changes the whole data model: a forecast is not a number, it is a dated photograph. Every month, on the day the planning cycle closes, one version is frozen that projects the months ahead. That photo is never touched again. Later, when reality arrives, you compare against the photo matching the horizon you care about.
Then comes the dimension almost nobody models: the horizon. Forecasting next month is easy. Forecasting three months out, which is where the buying decisions on imported inputs get made, is a different job altogether. Mixing the two in a single indicator is like averaging the temperature of the oven with that of the fridge.
The load script: one row per SKU, month and version
// ============================================================
// FORECAST: one row per (SKU, target month, frozen version)
// MesVersion = the month the forecast was closed and is NOT touched.
// ============================================================
ForecastRaw:
LOAD
SKU,
Date(MonthStart(FechaObjetivo)) AS MesObjetivo,
Date(MonthStart(FechaVersion)) AS MesVersion,
Unidades AS UnidadesPronosticadas
FROM [lib://QVD/forecast_snapshots.qvd] (qvd);
// Qlik has no months-difference function, so it is
// computed by hand. Horizonte 1 = next month's forecast.
Forecast:
LOAD
SKU,
MesObjetivo,
MesVersion,
UnidadesPronosticadas,
(Year(MesObjetivo)*12 + Month(MesObjetivo))
- (Year(MesVersion) *12 + Month(MesVersion)) AS Horizonte
RESIDENT ForecastRaw
WHERE (Year(MesObjetivo)*12 + Month(MesObjetivo))
- (Year(MesVersion) *12 + Month(MesVersion)) >= 1;
DROP TABLE ForecastRaw;
// ============================================================
// The actuals are GLUED to the snapshot with an aggregated LEFT JOIN.
// They end up repeated once per horizon: read the warning.
// ============================================================
LEFT JOIN (Forecast)
LOAD
SKU,
Date(MonthStart(FechaVenta)) AS MesObjetivo,
Sum(Unidades) AS UnidadesReales,
Sum(Unidades * CostoUnitario) AS CostoReal
FROM [lib://QVD/ventas.qvd] (qvd)
GROUP BY SKU, Date(MonthStart(FechaVenta));
STORE Forecast INTO [lib://QVD/fact_forecast_vs_real.qvd] (qvd);Notice the WHERE of the second block. It discards horizons of zero or less, meaning the forecast issued during the very month it claims to predict. Without that filter, junk gets in and inflates your accuracy without you noticing. It cost me two weeks of reloads the first time I built this. I was comparing against the latest revision and could not work out why the dashboard looked so good.
The three expressions that hold up QlikSense forecast accuracy
With the model flat, the formulas stay short. Each one, however, answers a different question and they are worth keeping apart. First define a variable vHorizonte with a default value of 1, so the dashboard does not end up with the horizon burned into the expression.
// 1. WEIGHTED ACCURACY (1 - WAPE)
// Total error against total volume. Does not blow up on small SKUs.
1 -
Sum({<Horizonte={"$(vHorizonte)"}>}
Fabs(UnidadesReales - UnidadesPronosticadas))
/
Sum({<Horizonte={"$(vHorizonte)"}>} UnidadesReales)
// 2. BIAS (sign included)
// Positive = you over-forecast. Negative = you fell short.
Sum({<Horizonte={"$(vHorizonte)"}>}
UnidadesPronosticadas - UnidadesReales)
/
Sum({<Horizonte={"$(vHorizonte)"}>} UnidadesReales)
// 3. TYPICAL ERROR PER SKU (median, not average)
// AGGR drops the calc to SKU-month grain, then takes the median.
Median(
Aggr(
Sum({<Horizonte={"$(vHorizonte)"}>}
Fabs(UnidadesReales - UnidadesPronosticadas))
/ Sum({<Horizonte={"$(vHorizonte)"}>} UnidadesReales)
, SKU, MesObjetivo)
)Three details worth the afternoon. Qlik's absolute-value function is fabs(), not Abs(); it still strikes me as an irritating design decision inherited from C, but it is what we have. The $(vHorizonte) goes in double quotes inside the set so it accepts a range of the type ">=1<=3" when you want to look at the whole quarter. And the Aggr() in the third expression opens by SKU and month before summarising, which is precisely what the company average hides from you.
The number that turns bias into money
The three expressions above speak in percentages, and percentages do not move a finance manager. This one does.
// BIAS EXPOSURE IN MONEY
// How much capital you tied up (or failed to sell) by missing
// the forecast in the wrong direction.
Sum({<Horizonte={"$(vHorizonte)"}>}
(UnidadesPronosticadas - UnidadesReales)
* (CostoReal / RangeMax(UnidadesReales, 1))
)The RangeMax(UnidadesReales, 1) avoids the division by zero when a forecast SKU sold nothing that month, which happens to be the most expensive case and the one that repeats most. A product with zero sales and a forecast of a thousand units shows up in no MAPE at all, because the denominator collapses. It does show up in the warehouse.
What the business gains once the bias is visible
Separating error from bias changes the management conversation, and fairly fast. Absolute error is a technical problem for the planning team: better models, better data, more history. Bias, in contrast, is almost never technical. It is organisational.
When a dashboard shows sustained positive bias in a product line over six months, you are not looking at a bad algorithm. You are looking at someone covering themselves: a sales manager who would rather order too much than explain a stockout, or a commercial plan used as a target and as a forecast at the same time. Those are two different documents and in many companies they are the same Excel file.
In cash terms, the arithmetic is direct. If the cost of holding inventory runs between 20% and 30% of value per year, a positive bias of 8% on a portfolio of one billion pesos leaves some eighty million tied up that cost between sixteen and twenty-four million a year just to hold. That number, placed in a KPI at the top right of the dashboard, tends to achieve in one meeting what three methodology presentations never did.
Common mistakes when calculating QlikSense forecast accuracy
I have seen these four in production, and three of them I made myself.
- Summing actuals without fixing the horizon. The
Left Joinin the script repeats sales once for every available horizon. That is why every expression carries the set{<Horizonte={...}>}. If you build a total-sales KPI on that table, it will give you three or four times the real figure. Leave official sales in their own app and use this one only for accuracy. - Averaging MAPE by SKU. A product that sold three units and was forecast at thirty throws out a 900% error. That single record drags the average of a whole category. That is why the expression uses
Median()and the headline indicator uses weighted WAPE. - Mixing horizons in the same indicator. When the committee asks for “the accuracy”, ask how many months out. If nobody defines it, define one yourself as the official one and publish the rest as diagnostics.
- Loading the forecast from the live file. If the script points at the Excel file planning edits daily, your history rewrites itself. Freeze the snapshot with a reload task on the first working day of the month and store it in a QVD.
Practices I learned the hard way
Publish the four expressions as master measures from day one. This is not purism: when the number circulates across three different apps, sooner or later somebody will write the formula again and forget the horizon filter. A master measure, besides, keeps the comment visible, and that comment is what prevents the argument at the next meeting.
Segment before you compare. An ABC by volume and an XYZ by variability are calculated in the same script with two Aggr(). That way you can demand 90% accuracy where it belongs and accept 55% where the product is erratic by nature. Demanding the same standard of the whole catalogue is the fastest way to make the planning team stop believing in the dashboard.
Keep the naive forecast too, meaning repeat last month. If your sophisticated model cannot beat that one-line rule, you have a pending conversation with your planning software vendor. More than once that contrast has been the most uncomfortable finding of the project. I write about these crossings between technology and business decisions fairly often at hectorpincheira.com.
Finally, fix the frequency. Forecast accuracy measured once a year corrects nothing; measured every week it generates noise and panic. Monthly, with the close.
The thermometer and the fever
A forecast is not a prediction of the future, it is an instrument for measuring the present. When it is systematically miscalibrated upwards, it is not telling you what will happen: it is telling you how your organisation behaves under uncertainty, what it rewards and what it punishes. That is why I think this dashboard, of all the ones you can build in QlikSense for finance, is the most uncomfortable. It does not show products. It shows behaviour.
One question stays open that I still cannot answer well, and I leave it standing: if your forecast has carried positive bias for eighteen months and nobody corrected it, is the problem the forecast, or is somebody in the company getting exactly what they wanted?




