Do people come back?
Weekly cohorts of new users, and the share of each cohort that did anything in the app in the weeks after signing up. About 46% come back in week one and 24% are still active in week five. Sample data from a fictional app, written by a coding agent.
retention() comes from DuckDB's behavioral extension. For each user it takes one condition per week, "active in the signup week", "active one week later", and so on, and returns a true/false list. Averaging those lists per cohort gives the share of people who came back. The plain-SQL version of this query needs a self-join and a separate count of cohort sizes.
Finding: Pro users come back more. 53% of them are active the week after signing up against 45% of free users, and the gap widens to 35% against 27% by week four. Later weeks include fewer cohorts, so the last rows rest on fewer users (see the last column). Next: look at what pro users do in their first week that free users do not.