EnableYourData.com

KPI · Inventory, purchasing and production

Days of supply: formula and example.

Days of supply shows how many days your current stock will cover demand. You divide stock in units by average daily demand, based on recent sales or a forecast. It is a forward-looking KPI for replenishment and for spotting shortages or overstock.

Days of supply formula

Current stock in units ÷ average daily demand

Worked example

Acme Groothandel has 2,000 boxes of printer paper in stock. Over the last 30 days it sold 1,500, an average of 1,500 ÷ 30 = 50 a day. Days of supply is 2,000 ÷ 50 = 40 days.

Fictitious figures for Acme Groothandel, a sample wholesaler.

How to read this KPI

If days of supply is shorter than the supplier lead time, you are likely to run out before new stock arrives. Far more cover than you need points to overstock. Compare per product with the lead time plus the safety margin you work with.

Pitfalls with days of supply

  • Using average demand from a period with a promotion or seasonal peak.
  • Counting reserved or blocked stock as available.
  • Ignoring open purchase orders, so you reorder when stock is already on its way.

SQL & DAX

Calculating days of supply in SQL and DAX

Two examples on a fictitious data warehouse for Acme Groothandel: a PostgreSQL query and a measure for a Power BI model. Adjust table and column names to your own model.

SQL · PostgreSQL
WITH demand AS (
  SELECT product_id, SUM(ABS(quantity)) / 30.0 AS avg_daily_demand
  FROM stock_movements
  WHERE movement_type = 'sale'
    AND movement_date >= current_date - interval '30 days'
  GROUP BY product_id
),
on_hand AS (
  SELECT product_id, SUM(quantity) AS qty
  FROM stock_levels
  WHERE snapshot_date = (SELECT MAX(snapshot_date) FROM stock_levels)
  GROUP BY product_id
)
SELECT p.sku, p.name, oh.qty AS on_hand,
       ROUND(d.avg_daily_demand, 1) AS avg_daily_demand,
       ROUND(oh.qty / NULLIF(d.avg_daily_demand, 0), 1) AS days_of_supply
FROM on_hand oh
JOIN products p ON p.product_id = oh.product_id
LEFT JOIN demand d ON d.product_id = oh.product_id
ORDER BY days_of_supply NULLS LAST;
DAX · Power BI
Avg Daily Demand = DIVIDE(CALCULATE(SUMX(StockMovements, ABS(StockMovements[Quantity])), StockMovements[MovementType] = "sale", DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -30, DAY)), 30)
Days of Supply = DIVIDE(CALCULATE(SUM(Stock[Quantity]), LASTNONBLANK('Date'[Date], CALCULATE(SUM(Stock[Quantity])))), [Avg Daily Demand])

In ENABLE

Tracking this KPI in ENABLE

Plain-language questions

Ask for days of supply per month, customer or product in the SQL Explorer with AI. The AI writes the SQL, you see the query and run it yourself; the AI only receives metadata.

Read more →

In your Power BI dashboard

Define the KPI as a measure in your Power BI model and show it in the portal, with "Last refreshed" next to it. Access profiles and optional row-level security decide who sees which figures.

Read more →

Custom dashboards (pilot)

Add the KPI as a tile to a custom dashboard, compared with last year. The Dashboard Builder is a pilot and can be switched on per client.

Read more →

Monthly targets

With the built-in Targets app you set a target for the KPI per month, so you see actuals and target side by side.

Read more →

FAQ

Frequently asked questions

How do you calculate days of supply?

Divide current stock of a product by average daily demand. For demand you can use sales from the last few weeks or a forecast. For seasonal products, the forecast is usually the better choice.

What is the difference between days of supply and DIO?

Days of supply looks forward and works per product in units. DIO looks back and works for the whole business in money, based on cost of goods sold. Use the first for replenishment and the second for working capital.

How many days of supply do you need?

At least the supplier lead time plus a safety margin for swings in demand and lead time. How large that margin is depends on how predictable the product and supplier are. Work it out per product rather than using one fixed number.

Use AI on your own data. Securely, and without the headache.

In an online demo we show how ENABLE makes your data securely available and how you build on it: describing an app in the AI Builder, plain-language questions, dashboards and APIs. And how we set it up and manage it for you.