How to calculate customer purchase frequency
Purchase frequency starts with the gaps between valid orders. The aim is not to force every account into one alert rule, but to establish a defensible reference for that customer.
Calculate intervals, not order counts
Sort one customer’s valid orders from oldest to newest. With at least two orders, the average interval is the time from the first order to the last, divided by the number of gaps between them.
Average interval = (last order date − first order date) / (number of orders − 1)The subtraction by one matters: four orders create three intervals. With only one order there is no interval to measure, so do not present a frequency as if it were observed behavior.
Four orders, three intervals
Consider orders placed on 10/01, 09/02, 10/03, and 12/04 of the same non-leap year. The dates are written as day/month.
| From | To | Interval |
|---|---|---|
| 10/01 | 09/02 | 30 days |
| 09/02 | 10/03 | 29 days |
| 10/03 | 12/04 | 33 days |
The interval from the first to the last order is 92 days. Therefore: 92 / (4 − 1) = 30.7 days. Summing the individual intervals gives the same check: (30 + 29 + 33) / 3 = 30.7 days.
Keep the calculation traceable
At minimum, keep these columns in an export or table:
- Customer ID or customer name, to group orders correctly.
- Order ID, to preserve one record per order and allow checking.
- Order date, used to sort the sequence and calculate the gaps.
A cancellation or status field helps exclude orders that should not represent demand. Product line can also be useful when a customer buys distinct categories on different cycles. Compare like with like before combining them.
Measure recency separately
Recency is today’s date minus the date of the last valid order. It answers how long the account has been quiet; the average interval describes its historical rhythm. They are related, but they are not the same measure.
Treat variation as information
An average is useful when intervals are reasonably stable. When they swing, inspect the median and the spread of the intervals as well. The median describes a typical gap with less influence from one unusual order; the range or another variability measure shows how much the cadence actually moves.
Separate seasonality before judging a delay. A customer that routinely pauses in a planned shutdown or orders around an annual budget cycle needs a seasonal reference, not a single all-year average. A conversation or alert should use that account’s history, commercial context, and the reliability of the data. There is no universal number of days that proves risk.
