Weekly Rider Retention Curves by First-Trip Cohort
Last updated: November 29, 2026
Quick Overview
Using a trips table, build weekly cohorts of riders by the week of their first completed trip and compute the share of each cohort that completes a trip in each of the following eight weeks.
Uber
November 29, 20260
0
0 solved
Using a trips table, build weekly cohorts of riders by the week of their first completed trip and compute the share of each cohort that completes a trip in each of the following eight weeks.
Rider retention by cohort is a standard health metric for Uber's rides and Eats growth teams, and this query appears in data science onsites. The interviewer checks the cohort definition, distinct counting, and correct denominators.
What the Interviewer Expects
- Define the cohort by first completed trip, not first request
- Deduplicate to rider-week activity before joining
- Compute week offsets from cohort week
- Use the full cohort size as the denominator
- Explain how to show weeks with zero retention
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you split cohorts by acquisition channel?
- How would you compute retention for Uber One members only?
- Why might the latest cohorts look worse and how would you mask that?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
trips(trip_id, rider_id, requested_at, status). Retention means at least one completed trip in that week. Weeks start Monday. The dialect below is Presto/Trino style (DATE_TRUNC, DATE_DIFF)....
Approach
- Build one row per rider per active week (completed trips only).
- Cohort week = each rider's first active week.
- Join activity back to cohorts and compute
week_offset. - Count distinct active...