Inventory Formulas & Methodology: Safety Stock, ROP, DIO
Every number StockLogic shows you is produced by the standard inventory formulas below, computed entirely in your browser. Nothing here is a black box — each section states the formula, defines its variables, and lists the safeguards applied to real-world CSV data.
1. Safety Stock
The Safety Stock tool protects against two uncertainties at once: variation in daily demand and variation in supplier lead time. When lead-time variability is available and reliable, the combined formula is used:
When lead-time variability is not reliable (too few PO lines, or the variability toggle is off), the tool falls back to the classic fixed-lead-time formula:
| Symbol | Meaning |
|---|---|
| SS | Safety stock quantity, in units (rounded up to whole units, or to pack size when set). |
| Z | Service level factor — the standard normal inverse of the target service level (e.g. 95% → Z ≈ 1.65, 98% → Z ≈ 2.05). |
| d | Average daily demand = average monthly demand ÷ 30. |
| σ_d | Demand volatility — standard deviation of the daily demand rate (monthly standard deviation ÷ 30). |
| LT | Average lead time in calendar days. When periodic review is on, LT becomes the protection period = lead time + review period. |
| σ_LT | Lead-time variance — standard deviation of historical lead times, in days. |
How the inputs are derived
- Daily demand (d): total demand over the history window ÷ 24 months ÷ 30 days, using only the sales types you selected as real demand.
- Lead time (LT): measured strictly as Delivered Date − Order Date per closed PO line, in calendar days. Early deliveries are included. The requested date is never used here — it is reserved for supplier lateness scoring.
- Lead-time fallback chain: item-level average (minimum PO lines met) → supplier average (same minimum) → your manual default lead time. σ_LT = 0 whenever the fallback is used.
- Z (service level): set per ABC class. Inputs are bounded to 50–99.9%; an invalid or missing value falls back to 95% (Z ≈ 1.65).
2. Reorder Point (ROP)
The reorder point is the stock level at which a new purchase order should be placed:
The maximum stock level shown on the gauge is a typical order-up-to level:
ROP and Max Stock are rounded up to whole units. Negative or missing daily sales, lead times and safety stock values are clamped to zero before the calculation, so sparse ERP exports can never produce a negative or NaN threshold.
3. Recommended Order Quantity & PO Gating
Order recommendations are gated on inventory health, so healthy items are never ordered unnecessarily:
If Net Stock ≤ ROP → Status "Reorder", Rec PO = max( ROP − Net Stock , MOQ )
| Symbol | Meaning |
|---|---|
| MOQ | Minimum order quantity, read from the optional MOQ column of the Operations CSV (aliases: Minimum Order Quantity, Min Lot Size, Min Order Qty). Missing, empty, zero or negative values default to 1. |
| Demand Deficit | ROP − Net Stock: what current stock cannot cover of the reorder target. |
The result is rounded up to whole units. Gating means a healthy SKU (Net Stock above ROP) always recommends 0 — the MOQ never forces an order when stock is fine.
4. Excess Stock & Days of Inventory Outstanding (DIO)
DIO measures how many days today's stock would cover at the recent rate of demand:
Excess is everything beyond the healthy (green) days-of-cover threshold you set:
Excess Value = Excess Qty × Unit Cost
Shortfalls (stock below the healthy level) clamp to zero rather than going negative, so a stockout on one item can never net off real surplus on another and understate total excess. Items with zero demand report 0 days of supply instead of Infinity. Each item is flagged green / amber / red against your DIO thresholds (default 90 days healthy, 180 days review), and each item's share of total excess value is reported.
Demand lookback windows
- Excess & DIO — 6-month recent turn rate: average monthly demand = last 6 months of sales (Operations file) ÷ 6, so items that have slowed down surface as excess quickly.
- Safety Stock — 24-month demand pattern: demand mean and volatility use all 24 monthly columns of the Forecast file, so buffers reflect a full seasonal cycle rather than one quarter.
- Reorder Point page — 6 or 12 months: daily sales use the demand history window you pick on that page (default 12 months).
5. ABC Classification (80/20 Pareto)
Items are ranked by annual value and classified on cumulative share, with the cut-offs you set on the ABC page (default 80% / 15%):
Class A: cumulative ≤ 80% · Class B: ≤ 95% · Class C: remainder
The Safety Stock and Reorder Point tools read the exact same classes (and the same service-level stratification: A 98%, B 95%, C 90% by default), so an item shown as Class A on the ABC page is Class A everywhere.
6. Data Handling & Safeguards
Real-world CSV exports are messy. Before any formula runs, the data passes these guards:
- Outlier truncation: demand months and lead-time samples beyond 5 standard deviations from the median (measured robustly via median/MAD) are clamped before safety stock and ROP math, so a single mistyped cell cannot inflate a buffer.
- Non-negative clamping: stock, cost, demand, lead times and standard deviations are clamped to zero; square-root arguments are guarded so NaN can never appear.
- Finite outputs: every exported number is rounded to a fixed precision and guaranteed finite — no 12.000000000000002 artifacts, no NaN or Infinity in tables or CSV downloads.
- Duplicate SKU merging: repeated SKU rows are merged on upload (demand and stock aggregated, latest metadata kept), so result tables never contain ghost rows or key conflicts.
- Date validation: malformed or impossible dates are excluded from lead-time variance and flagged rather than silently distorting averages.
7. Privacy & Security Architecture
100% Client-Side Processing
All inventory calculations run as browser JavaScript on your own device — no WebAssembly plugins, no server round-trips, no cloud databases in the calculation path.
Zero Data Transmission
CSV data is never uploaded. Files are parsed and stored locally in your browser session and persist only in your own browser's local storage — there is no server-side persistence of inventory data.
Session Privacy Masking
All financial, SKU and quantity tables carry DOM data masking (the ph-no-capture class), so analytics session replays cannot capture SKU codes, costs or stock values.
The one exception: Process Mapping is the only tool that sends data outside your browser — the text you paste into it is sent to an AI service for analysis. No CSV uploads, stock figures or financial data are ever transmitted by any other tool. Usage analytics are event-only (for example "a CSV was uploaded", with file type and size, never filenames or contents).