How to forecast demand after a stockout, when your sales history undercounts
A week you were out of stock records what you could sell, not what customers wanted. Build a forecast on it and the next order can come out short. This post works three ways to estimate the demand you missed, shows how not to count the restock spike twice, and runs the order quantity both ways. The SKU and every number in the worked example are invented so the arithmetic can be checked.
- Sales stand in for demand only when stock was not limiting them. A stockout week records a floor, not the demand.
- Three simple estimates: units ÷ days in stock (the in-stock-days rate), the average of clean neighbour weeks, and the SKU’s normal share of a group of sister SKUs.
- Leave the restock weeks out of the rate, or the pent-up spike right after restock pushes the estimate too high.
- Do not count it twice: customers who waited and bought on restock are already in the restock sales. Subtract them from the lost-sales estimate.
- In the invented example, raw sales give 8.51 units a day and corrected demand 10.05. The raw-sales order is 101 units smaller and is projected to use up its whole safety buffer before the next order lands.
A demand forecast starts from history, and history is sales. On every day the SKU was on the shelf, sales and demand are close enough to treat as the same thing. On a day it was out, sales are zero and demand was not. Average those days in and the rate comes out low, the order quantity comes out low, and the next order is more likely to run short. A second stockout then puts more zeros into the history. That loop does not always close, but it is a risk worth a few minutes of arithmetic to remove.
The fix is to replace what you sold with an estimate of what you would have sold, for the stockout days only, and to label those periods as estimated so they are never mistaken for recorded sales later. The result is called unconstrained demand: demand as if stock had not been the limit.
The worked example (invented SKU and sales)
An invented white ceramic coffee dripper ships from one warehouse. Here are its last 12 weeks, with the number of days each week it was in stock. It ran out at the end of day 3 of week 7 and the replenishment landed on day 5 of week 9: 15 days out.
| Week | Days in stock | Units sold | Note |
|---|---|---|---|
| 1 | 7 | 68 | |
| 2 | 7 | 72 | |
| 3 | 7 | 70 | |
| 4 | 7 | 66 | |
| 5 | 7 | 74 | |
| 6 | 7 | 71 | |
| 7 | 3 | 31 | Ran out after day 3 |
| 8 | 0 | 0 | Out all week |
| 9 | 3 | 44 | Restocked day 5 |
| 10 | 7 | 78 | First full week back |
| 11 | 7 | 69 | |
| 12 | 7 | 72 | |
| Total | 69 | 715 | 84 days, 15 out |
The raw rate is what a spreadsheet gives you if you divide sales by calendar days:
raw daily rate = 715 units ÷ 84 days = 8.51 units a day (59.58 a week)
No clean week (1 to 6, 11 and 12) sold fewer than 66. The raw rate, 59.58 a week, sits below all of them because 15 zero days are averaged in. (Rates in this post are computed unrounded and shown to two decimals.)
Method 1 — The in-stock-days rate
The quickest correction divides units by the days the SKU could actually be bought, then scales back up to the full period:
in-stock-days rate = units sold ÷ days in stock; estimated demand for a period = that rate × days in the period
Over the whole window
715 units ÷ 69 days in stock = 10.36 a day, or 870.43 units over the 84 days. That is a big jump from 8.51, and it is a little too high. Weeks 9 and 10 are inside the window, and those are the weeks when customers who had waited came back.
The upward bias right after restock
Take the restock weeks on their own: 44 + 78 = 122 units in 3 + 7 = 10 days in stock, or 12.2 a day. Week 9 alone, scaled to a full week, would be 44 ÷ 3 × 7 = 102.67 units, and no clean week came close to that. The in-stock-days rate assumes every day in stock is a normal day. The days right after a restock are not: they carry demand that built up while you were out.
The fix: leave the restock weeks out of the rate
Drop weeks 9 and 10 from both the units and the days:
(715 − 44 − 78) units ÷ (69 − 3 − 7) days = 593 ÷ 59 = 10.05 units a day (70.36 a week)
The order section below uses this rate; the restock and corrected-history sections use method 2’s 70.4 a week, which differs by 0.01 a day. Which weeks count as restock weeks is a judgement call. Here the clean weeks before the stockout ran 66 to 74, so week 10 at 78 still looks lifted and comes out too. A heuristic: exclude the partial restock week and the first full week after it, then check whether the next week looks like the weeks before the stockout. If it does not, exclude that one as well.
Method 2 — Neighbour weeks
Instead of scaling the stockout weeks up, borrow from the clean weeks on either side. Take the three clean weeks before (4, 5, 6) and the clean weeks after the restock spike (11, 12):
neighbour average = (66 + 74 + 71 + 69 + 72) ÷ 5 = 352 ÷ 5 = 70.4 units a week (10.06 a day)
Method 1 said 10.05 a day; method 2 says 10.06. They agree because the invented SKU sells at a steady rate. On your own data, a disagreement is information: a trend, or an unusual neighbour week.
For a seasonal SKU, where the weeks either side of the gap are not a fair stand-in, use last year: take the ratio of the same weeks to their neighbours last year (if they were in stock) and apply it to this year’s neighbours.
Method 3 — Share of a group
The dripper comes in three colourways. Black and sand stayed in stock the whole time. When one member of a group is out, the rest of the group can tell you how busy the period was.
Worked example (invented sister-SKU sales)
| Weeks | White (this SKU) | Black + sand |
|---|---|---|
| 1–6 (all in stock) | 421 | 841 |
| 7, 8, 9 (white out 15 days) | 75 recorded | 150 + 158 + 149 = 457 |
In the clean weeks white sold 421 ÷ 841 = 0.5006 units for every unit of black and sand. Apply that to the stockout weeks:
white demand for weeks 7–9 = 457 × 0.5006 = 228.77 units
That is higher than method 2’s 3 × 70.4 = 211.2. The reason is in the sister SKUs’ numbers. In weeks 1 to 6 they averaged 841 ÷ 6 = 140.17 a week, or 420.5 over three weeks. In the stockout weeks they sold 457: 36.5 more than their own normal. Some of that lift may be white buyers who bought black or sand instead. It could also be more demand for the whole group, a promotion, or noise, and these numbers alone cannot tell you which. Any switched units are counted once in the sister SKUs’ sales, and the ratio then counts them again as white demand, so using the full 457 risks counting them twice.
For this worked example, assume the full 36.5-unit lift was substitution, and take it out first:
(457 − 36.5) × 0.5006 = 420.5 × 0.5006 = 210.5 units
Now it agrees with method 2 to within a unit. Under that assumption the 36.5 switched units were not lost sales for the business, they moved: count them as substitution when you cost the stockout. With real data, adjust only for the switching you have evidence for.
This method can still be useful when the stockout is long and no clean neighbour weeks are close by. It breaks first if the group is badly chosen: the sister SKUs need the same buyers and reasons to buy, not only a category label.
The restock spike: do not count it twice
Once you have a daily rate, it is tempting to estimate lost sales as rate × days out, add that to recorded sales, and call the total demand. Try it:
- Estimated demand on the 15 days out: 15 × 10.06 (method 2) = 150.86 units
- Recorded sales plus that estimate: 715 + 150.86 = 865.86 units, or 865.86 ÷ 84 = 10.31 a day
10.31 is above every method’s estimate. Customers who waited and bought on restock are already in the recorded sales for weeks 9 and 10; adding the full stockout estimate counts them a second time.
Estimate the recaptured units as restock sales above the normal rate:
- Week 9: 44 sold in 3 days, against 3 × 10.06 = 30.17 normal, so 13.83 extra
- Week 10: 78 sold, against 70.4 normal, so 7.6 extra
- Recaptured: 13.83 + 7.6 = 21.43 units
Subtract them: 865.86 − 21.43 = 844.43 units, or 10.05 a day, back in line with methods 1 and 2. Of the 150.86 units of demand on days out, 21.43 came back later and 150.86 − 21.43 = 129.43 did not: one simple lost-sales estimate. If you also take method 3’s assumption that about 36.5 units switched to the black and sand colourways, the sales lost to the business were nearer 93. The same logic applies to backorders: if you took orders while out and shipped them on restock, they are recorded as restock sales, and they belong in the stockout days’ demand once, not twice.
Lost sales = estimated demand on the days you were out, minus the demand that came back when you restocked.
The corrected history
Write the corrected series down next to the recorded one and mark which weeks are estimates. Here weeks 7 to 10 are replaced with the neighbour average of 70.4:
| Week | Recorded units | Demand used for forecasting | Status |
|---|---|---|---|
| 1–6 | 421 | 421 | Recorded |
| 7 | 31 | 70.4 | Estimated (stockout) |
| 8 | 0 | 70.4 | Estimated (stockout) |
| 9 | 44 | 70.4 | Estimated (stockout and restock) |
| 10 | 78 | 70.4 | Estimated (restock spike) |
| 11–12 | 141 | 141 | Recorded |
| Total | 715 | 843.6 | 70.3 a week, 10.04 a day |
The status column matters later. When you measure forecast accuracy, comparing a forecast with recorded sales in a stockout week makes a good forecast look wrong. Compare against the estimated demand, or leave stockout weeks out of the error.
What the correction does to the order
Now run one order both ways. The assumptions, all invented and stated so you can swap in your own:
- Lead time 28 days from purchase order to sellable stock, and you order every 28 days, so each order has to cover 28 + 28 = 56 days until the next one lands. Orders do not overlap: nothing else is on order today.
- Safety stock held as 10 days of demand. That is a days-of-cover heuristic for this example; your own buffer should come from a safety stock calculation on your demand and lead-time variation.
- On hand 320 units today.
order = daily rate × (lead time + review period + safety days) − on hand − on order
In words: enough to reach the next arrival with the buffer intact, minus what you have.
| Raw sales | Corrected demand | |
|---|---|---|
| Daily rate | 8.51 | 10.05 |
| Target stock: rate × 66 days | 561.79 | 663.36 |
| Minus 320 on hand | 241.79 | 343.36 |
| Order (rounded to whole units) | 242 | 343 |
The raw-sales order is 101 units smaller. The raw rate is 15.31% below the corrected rate, and the whole of that shortfall lands on the order, because the 320 units on hand do not change.
Play it forward
Suppose demand runs at the corrected 10.05 a day. Over the 28-day lead time it uses 28 × 10.05 = 281.42 units, so 320 − 281.42 = 38.58 are left when the order lands. Then each order has 28 days to last:
| Raw-sales order | Corrected order | |
|---|---|---|
| Stock when the order lands: 38.58 + order | 280.58 | 381.58 |
| Minus 28 days at 10.05 | −281.42 | −281.42 |
| Left when the next order lands | −0.85 | 100.15 |
| Buffer left, in days of demand | none | 9.96 |
The corrected order arrives at the next delivery with its 10-day buffer intact. The raw-sales order uses up essentially all of its buffer and ends within one unit of zero before the next delivery. Any week busier than average in that stretch, or a delivery a few days late, can turn that into another stockout, and another run of zeros in next month’s history. That is the loop, in numbers.
Where this breaks
Partial stockouts
If the dripper came in sizes and only one size was out, the parent product would never show a zero day. Its sales would dip, and a parent-level forecast would read the dip as falling demand. Track days in stock at the variant level, the level you reorder at, and correct each variant on its own. The share-of-group method then becomes the natural tool: the in-stock sizes are the group.
Low stock that hides the product before it hits zero
A SKU with a handful of units left can sell below its rate before it reaches zero: a sales channel may show it less, or a bundle or ad that uses it may pause. Those days count as in stock but sell like stockout days. If sales slide just before a stockout, treat those days as constrained too, and mark them.
Demand that does not wait
The 21.43 recaptured units belong to this invented SKU. With close substitutes, customers may buy elsewhere and the restock spike may be small; with a loyal following it can be large. Measure it on your own restocks rather than assuming a fixed share.
The rate was moving anyway
Every method here assumes the stockout weeks would have looked like the weeks around them. If the SKU was growing, launching or entering its season, they would not. Use last year’s ratio or the share-of-group method, which moves with the group. A stockout during a promotion needs the promotion’s lift estimated on its own, as in a promotion forecast.
The stockout also bends the other numbers
Zero weeks also widen the spread of weekly sales, which can distort a safety stock calculation fed raw sales. Days-of-supply and days of inventory on hand figures that divide by a stockout-depressed rate come out too comfortable, which is why a SKU just back in stock can sit low on a reorder priority list when it belongs near the top. Correct the rate once, and use the corrected rate everywhere.
What to do this week
- For each SKU you reorder, pull the last 12 weeks of units and days in stock, at the variant level.
- Flag every week with fewer than 7 days in stock, and the first full week after each restock.
- Estimate those weeks two ways: the in-stock-days rate with restock weeks left out, and the neighbour average. If they differ by more than you would accept in a forecast, find out why before ordering.
- Where a sister SKU stayed in stock, run the share-of-group check, and take its lift out first.
- Write the corrected series next to the recorded one, marked estimated, and recompute the order quantity and reorder point from it.
- Record the lost-sales estimate (stockout demand minus recaptured demand) so the cost of the stockout is a number, not a feeling.
Questions people ask
How do I forecast demand after a stockout?
Replace the stockout days with an estimate of demand before you forecast. One simple estimate is units sold divided by days in stock, with the restock weeks left out; another is the average of clean weeks either side. Mark the replaced weeks as estimated, then forecast from the corrected series.
What is the difference between sales and demand?
Sales are what customers bought; demand is what they would have bought if stock had not run out. On days you were in stock the two are close. On days you were out, sales are zero or low and demand is not.
How do I estimate lost sales from a stockout?
Multiply the days out by your corrected daily rate to get demand during the stockout, then subtract the extra units sold right after restock, because those customers waited and came back. What is left is one simple estimate of sales that were lost.
Why does my forecast keep ordering too little after a stockout?
If the forecast averages in zero-sales days, its rate is too low, so the order is too small. A smaller order raises the risk of another stockout, which adds more zeros to the next forecast. Correcting the stockout days breaks that loop.
Should I include the sales spike after a restock in my forecast?
Not as a normal week. The spike carries demand that built up while you were out. Leave the restock weeks out of the rate, or replace them with the normal rate, and count the extra units once, as recaptured stockout demand.
What is an unconstrained demand forecast?
A forecast built on what customers would have bought with stock always available, instead of on recorded sales. Building one means estimating demand for stockout periods and labelling those periods as estimated.
