How to calculate Order Cycle Time
Order cycle time is the average time from a customer placing an order to receiving it.
Formula
Order cycle time = delivery date − order date, averaged over delivered ordersSQL query
This example assumes: orders(id, ordered_at, delivered_at). It is written in PostgreSQL syntax; date functions differ slightly in MySQL, BigQuery and SQLite, and your column names will differ from these.
SELECT DATE_TRUNC('month', ordered_at) AS month,
AVG(EXTRACT(EPOCH FROM (delivered_at - ordered_at)) / 86400) AS avg_days,
PERCENTILE_CONT(0.9) WITHIN GROUP (
ORDER BY EXTRACT(EPOCH FROM (delivered_at - ordered_at)) / 86400) AS p90_days
FROM orders
WHERE delivered_at IS NOT NULL
GROUP BY 1
ORDER BY 1;Common mistakes that make Order Cycle Time wrong
- Undelivered orders are missing from the average, which flatters recent months.
- The average hides the tail; the 90th percentile is what unhappy customers experience.
- Time zones can shift timestamps by a day for short cycles.
Ask for Order Cycle Time in plain English
Instead of writing the query yourself, you can type the question. SchemaChat turns it into SQL against your connected database or uploaded file, runs it, and shows the SQL and the figures it used so you can check the answer before you share it. It does not replace your judgement about the definition: check that the query matches the formula your business uses.
- What is our average and 90th percentile order cycle time by month?
- Which regions have the longest cycle time?