Retention
Also called: repeat purchase rate
The share of a group that comes back or buys again after a first event, measured over a stated window.
Formularetention = came back within [window] ÷ started in the cohort
How we work it through
- 1
Group people by when they started, not by when they returned.
- 2
Give every group the same window before comparing.
- 3
Say which groups’ windows are still open.
On the practice dataset
The query we run on Meridian, Atterna’s practice marketplace, and what it returns.
-- one purchase = one checkout, however many sellers
WITH p AS (
SELECT buyer_id, checkout_id, MIN(created_at) AS paid_at
FROM meridian.orders WHERE status = 'paid'
GROUP BY buyer_id, checkout_id),
k AS (
SELECT buyer_id, ROW_NUMBER() OVER (
PARTITION BY buyer_id ORDER BY paid_at) AS k
FROM p)
SELECT COUNT(*) FILTER (WHERE k = 2) * 1.0
/ COUNT(*) FILTER (WHERE k = 1)
FROM k;Result55% came back for another purchase (2,020 of 3,652) — but buyers whose first purchase fell in the promo week had a week at most: 46 of 494 (9%). Counting seller orders instead gives 66.6%.
The common trap
Measuring retention on a window that is still open, so recent customers look worse than they are.
ExampleMeridian: 2,020 of 3,652 paying buyers (55%) came back for another purchase within three weeks — a short window driven partly by a promo. Counting seller orders instead of purchases gives 66.6%, because one basket split between two sellers looks like a return.
When an AI answers
“Retention fell from 72% to 9% for the newest customers.”
- What it didn’t know
- It did not know the newest customers had a week at most to come back and the oldest had three.
- Ask back
- “Did every group have the same number of days to return?”
Read next
Examples use Meridian, Atterna’s fictional practice marketplace.