Shopify demand forecasting: methods, formulas and a workflow
Demand forecasting means estimating how many units of each product you will sell over a future period, so you can decide what to order and when. This guide covers the standard methods, the formulas behind them, and a step-by-step workflow you can run on a Shopify store.
What a demand forecast is for
A forecast is a number per SKU per time period, such as "about 120 units of this variant next month". On its own it changes nothing. It becomes useful when it feeds a purchasing decision: the reorder point, the safety stock buffer, and the size of the next purchase order.
Every forecast is wrong by some amount. The goal is a forecast that misses by less than your current guess, with the remaining error absorbed by safety stock. Framing it that way lets you improve one step at a time instead of waiting for a perfect model.
Start with the data you already have
Shopify records each order with its products, variants, quantities, discounts and dates, and you can export orders to a CSV file. For forecasting you want, per SKU and per day or week: units sold, units returned, whether a discount was running, and whether the item was in stock.
Clean the data before you calculate anything:
- Flag stockout periods. If an item was out of stock for ten days, those ten days of zero sales are not zero demand. Exclude them from your average or estimate what you would have sold.
- Flag promotions. A three-day sale inflates a plain average. Mark those days so you can model them separately.
- Use net units. Subtract returns so the numbers reflect demand you kept.
- Remove test orders and one-off bulk orders you do not expect to repeat.
- Keep variants separate where size or color drives demand. A forecast for the whole product hides which variant will run out first.
Choosing a forecasting method
The right method depends on how much history a SKU has and how stable its sales are. Start simple. A simple method you actually maintain is worth more than a complicated one you abandon.
Judgment, for products with no history
A new product has nothing to average. Base the first order on comparable products you already sell, on pre-orders or waitlist sign-ups if you collected them, and on your read of the market. Order conservatively, then replace the guess with real sell-through numbers as soon as you have a few weeks of sales.
Moving average
Average the last n periods of demand and use the result as the next period's forecast. It smooths noise but lags behind trends and ignores seasonality, so it suits stable products.
Forecast = (D1 + D2 + ... + Dn) ÷ n
D1 to Dn are the units sold in each of the last n periods.
Say a variant sold 120, 95 and 140 units in the last three months. The three-month moving average is (120 + 95 + 140) ÷ 3 = 355 ÷ 3 ≈ 118 units for next month.
A weighted moving average gives recent months more influence. With weights of 0.2, 0.3 and 0.5 (oldest to newest, summing to 1), the forecast is 120 × 0.2 + 95 × 0.3 + 140 × 0.5 = 24 + 28.5 + 70 = 122.5 units.
Exponential smoothing
Exponential smoothing updates the previous forecast by a fraction of the latest forecast error. It needs only the latest forecast and the latest actual, which makes it easy to run in a spreadsheet.
Next forecast = α × latest actual + (1 − α) × latest forecast
α (alpha) is a smoothing factor between 0 and 1. A higher α reacts faster to recent sales, and also reacts faster to noise.
Say last period's forecast was 100 units, actual sales were 120, and you use α = 0.3. Next forecast = 0.3 × 120 + 0.7 × 100 = 36 + 70 = 106 units.
Seasonal index
If demand follows a yearly pattern, calculate an index for each period (months for many stores, weeks or days of the week for others), then apply it to a baseline.
Seasonal index = average demand in that period ÷ average demand across all periods
Seasonal forecast = baseline demand × seasonal index
Say a SKU averages 200 units a month across the year, and past Decembers have averaged 500 units. The December index is 500 ÷ 200 = 2.5. If you expect next year's baseline to be 220 units a month (a 10% growth assumption), the December forecast is 220 × 2.5 = 550 units.
You need at least a full year of history to see seasonality at all, and two or more years to tell a repeating pattern from a one-off event. For help planning buys around peaks, see seasonal inventory planning.
Intermittent demand
Slow movers often sell nothing for days or weeks and then sell a few units at once. A moving average of that pattern rarely resembles any real period. Croston's method handles it by estimating two things separately: the typical size of a sale and the typical gap between sales. Its full version updates both with exponential smoothing; the simple version below shows the idea.
Forecast per period = average demand size ÷ average interval between demands
Say orders for a slow variant average 3 units, and a sale happens about once every 5 weeks. The forecast is 3 ÷ 5 = 0.6 units per week, or about 6 units over a 10-week lead time.
Adding known events
Causal (regression) models relate demand to inputs such as price, promotions and ad spend, but they need a lot of clean history. A practical alternative is to forecast the baseline first, then add an uplift for planned events, estimated from comparable past events. Apply that uplift only to the days the event runs, and flag those days in your history so they do not inflate future baselines.
A step-by-step forecasting workflow
1. Decide which SKUs to forecast first
Put the most forecasting effort where the most revenue sits. Rank products by revenue with ABC analysis, forecast the top group carefully, and use simpler rules such as minimum and maximum stock levels for the long tail.
2. Match the horizon to the decision
A forecast must look at least as far ahead as your supplier lead time plus the interval between order reviews. With a six-week lead time and weekly reviews, you need a forecast covering at least seven weeks. Error tends to grow as the horizon lengthens, so do not forecast further out than the decision requires.
3. Calculate baseline demand per day
Divide net units sold by the days the item was actually in stock, not by calendar days. For more on this measure, see sales velocity tracking.
Average daily demand = net units sold ÷ days in stock
Say a variant sold 360 units over 90 days but was out of stock for 10 of them. The calendar-day average is 360 ÷ 90 = 4.0 units per day. The in-stock average is 360 ÷ 80 = 4.5 units per day. Using 4.0 would under-forecast by 0.5 units a day, about 11%.
4. Apply seasonality and trend
Multiply the baseline by the seasonal index for the period. If sales are growing or shrinking steadily, scale the baseline by a growth factor you can defend from several months of data, not from one strong week.
5. Add planned events
Promotions, launches, and email or ad pushes all change demand. Estimate the extra units from comparable past events and add them to the baseline for those days only.
6. Convert the forecast into an order trigger
Reorder point = (average daily demand × lead time in days) + safety stock
Continuing the hypothetical above, say the lead time is 14 days and you hold 20 units of safety stock. Demand during the lead time is 4.5 × 14 = 63 units, so the reorder point is 63 + 20 = 83 units. When stock on hand plus stock already on order falls to 83, place the purchase order. This assumes you watch stock continuously. If you only review weekly, add the review interval to the lead time when you calculate demand during the lead time.
Use actual lead times from your past purchase orders rather than the supplier's quote, and see purchase order management for tracking them. Then multiply the order quantity by unit cost and check it against the cash you have available. A forecast you cannot afford to act on does not help.
7. Measure and adjust
Each week, compare forecast to actual units for your top SKUs. Track the size of the error and whether you consistently over- or under-forecast. The formulas and a worked example are in how to improve forecasting accuracy. Days of supply (stock on hand ÷ average daily demand) and inventory turnover show whether forecasts are producing sensible stock levels; more metrics are in the inventory KPI guide.
Common forecasting mistakes
- Treating stockout days as zero demand. This pushes the next forecast down and makes the next stockout more likely.
- Forecasting only at the category level. One variant can climb while another declines, and the category total hides both.
- Copying last year's numbers. Last year is a useful sanity check, but it ignores growth, new products and changes in marketing.
- Ignoring lead-time variability. A supplier who quotes two weeks but sometimes takes three makes a two-week plan wrong. The variation feeds directly into safety stock.
- Building a one-off spike into the baseline. One viral week can cause months of over-ordering if the baseline absorbs it.
- Forecasting items that should be cleared. A SKU with no sales for a long stretch needs a markdown or discontinue decision. See dead stock management.
- Not refreshing. A forecast built in January and left alone drifts as demand changes. Update it as new sales arrive.
Putting it into practice
- Pick your top ten SKUs by revenue.
- Export their orders for the past 6 to 12 months and mark stockout days and promotion days.
- Calculate in-stock average daily demand and a simple moving average for each.
- Add a seasonal index only where you have at least a full year of history.
- Set reorder points using real lead times, then compare forecast with actuals every week.
Once that routine works on ten SKUs, extend it to the next group down the revenue ranking.