ClearStock by InventoryX is live on the Shopify App Store.Install free →

Install ClearStock
English
  • English
Browse Resources

S2 · quantitative skill

Measuring velocity

How to turn a sales export into a mean daily demand and a daily standard deviation, with the denominator declared and the arithmetic shown.

The merchant question: my mug sells "about seven a day" — how do I get from that to a number I can put in a formula?

You need two numbers, not one. The mean daily demand — d̄ — tells you how much stock a lead time consumes. The standard deviation of daily demand — σ_d — tells you how much that consumption varies, and it sizes your safety stock. "About seven a day" gives you the first at best and nothing for the second. Both come from the same export, and the thing that must be declared before either is computed is the denominator: which days are in the average. This lesson uses in-stock days; the next takes that choice apart.

The two formulas

Mean daily demand

d̄ = (total units sold in the window) ÷ (number of days in the window, where "day" is defined)

Standard deviation of daily demand

σ_d = √[ Σ(x_i − d̄)² ÷ (n − 1) ]

where x_i is the units sold on day i and n is the count of days in the denominator. The n − 1 version is used because you are estimating a variance from a sample, not describing a census; with 79 observations the difference from n is under 1%, but the convention matters when someone later re-derives your number.

Where the inputs come from

Input Source What to check before you trust it
Units sold per day, per SKU Order export or POS daily summary, net of cancellations Returns netted at the right date; test orders excluded
Days in stock Inventory-level history, out-of-stock events, or a manual log Stockout days must be identified, not inferred from zero sales
Window length Your choice: 90 days is a common default Must be long enough for n ≥ 8 usable observations, short enough to be current
Netting rules Written down once Bundles, samples, and wholesale spikes handled consistently

The second row is the one that gets skipped. A zero-sales day is not evidence of a stockout, and a stockout is not evidence of zero demand; separating them takes availability history, and without it you cannot compute d̄ on in-stock days at all.

Worked example — MUG-GRN-12 at Marlow & Finch

Window: the last 90 days. Units sold: 559. Days the mug had zero available inventory: 11. In-stock days: 79.

  • d̄ = 559 ÷ 79 = 7.0759 → 7.08 units/day
  • Daily values on the 79 in-stock days give σ_d = 3.5 units/day

The interesting number is not the mean but the ratio: σ_d ÷ d̄ = 3.5 ÷ 7.08 = 0.49. Daily demand routinely swings ±50% around its own average — the mug sells 3 on a Tuesday and 11 on a Saturday. That ratio, not the mean, is what makes a buffer necessary.

Now put the numbers into the two quantities the rest of the library needs.

Mean lead-time demand (how much a 45-day lead time consumes):

d̄ × L̄ = 7.08 × 45 = 318.6 ≈ 319 units

Standard deviation of lead-time demand (how much that consumption wanders). Lead time itself varies, with σ_L = 4.5 days, so the variability of demand over the lead time has two sources:

σ_LTD = √(L̄ × σ_d² + d̄² × σ_L²) = √(45 × 3.5² + 7.08² × 4.5²) = √(45 × 12.25 + 50.13 × 20.25) = √(551.25 + 1,015.13) = √1,566.38 = 39.58 units

From which safety stock at a 95% cycle service level (z = 1.65):

SS = 1.65 × 39.58 = 65.3 ≈ 65 units

Note the decomposition, because it drives decisions: of the 1,566 units of variance, 1,015 comes from the supplier's lead time and 551 from demand. The store's first move is not a better forecast of the mug; it is a supplier whose dates move less.

Annual demand deserves a warning. The store uses D = 1,606 units. Note that 1,606 ÷ 7.08 = 226.8: the annual figure is built on about 227 selling days, not 365. Annualise the other way — 7.08 × 365 = 2,584 — and you have treated a per-open-day rate as though the store were open daily, overstating by 61% and sizing buffers for demand nobody will place. Reconcile the two and write the day count into the sheet.

Doing it for 620 SKUs. Compute in code, not by hand. With only 8 observations, a 90% chi-square band on the true σ runs from about 0.71σ to 1.80σ, so a short-history σ_d may be nearly half or nearly double the real one; below about 20 observations treat it as provisional and inherit a pooled value from the SKU's class.

Assumptions

Everything above is arithmetic conditional on six assumptions. They are stated with the running example's numbers so you can see when each one bites.

  1. Distribution of lead-time demand. Safety stock above treats demand over the lead time as normal with mean 318.6 and standard deviation 39.58. That is what makes z = 1.65 mean 95%. With d̄ = 7.08 over L̄ = 45, the normal gives roughly a 5% chance of lead-time demand exceeding 384; a skewed or lumpy series gives the same 5% a different shape and the same mean a different tail.

  2. Stationarity and independence. 7.08 and 3.5 assume the last 90 days represent the next 45. Breaks with the Q4 lift, a price change, a new listing, or a promotion — and quietly here, because the 11 dark days are probably not random: stockouts cluster on high-demand weeks, so the in-stock sample is biased toward calm days.

  3. Demand–lead-time independence. σ_LTD adds a demand variance term and a lead-time variance term as though the two were generated separately. They are not always: a viral post can drain stock and delay a restock in the same week. Positive correlation makes the figure above an understatement, because the covariance term is missing.

  4. Review regime. The 39.58 covers the lead time only, which is correct for continuous review where an order is placed the moment the position hits the reorder point. Under periodic review with a 12-day cycle, exposure is L + R = 57 days: σ = 39.58 × √(57 ÷ 45) = 39.58 × 1.1255 = 44.56, and SS = 1.65 × 44.56 = 73.5 ≈ 73 units. Using 65 in a periodic setting understates the buffer by 12%.

  5. Constraints ignored. No minimum order quantity, no pack size, no shelf life, no cash ceiling. Q = 296 is an unconstrained economic order quantity; if the supplier ships in cases of 24, the achievable 288 or 312 changes the cycle but not d̄ or σ_d.

  6. Observed sales as demand. Not treated as identical — that is the whole point of dividing by 79 rather than 90. But the ratio 559 ÷ 79 is still a censor-corrected estimate, and it assumes demand on dark days looked like demand on lit ones. It is a stated assumption, not a measurement.

Where this breaks

Mass stockouts. 11 dark days in 90 makes the correction mild. 40 in 90 does not: dividing by 50 in-stock days gives a rate that is technically a conditional mean and practically a fantasy, since the item was dark because it was popular.

Wholesale and one-off orders. A single 120-unit wholesale shipment lands as one day of demand 17 times the mean, dragging d̄ up and inflating σ_d for a year. Wholesale belongs in its own series with its own record, not in a retail rate.

Unit-of-measure drift and returns timing. A pack-size change mid-window rescales the series; returns credited at order date rather than return date distort both mean and spread. Neither appears as an error, only as a slightly odd number.