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
Data Manipulation (SQL/Python)
Data Scientist
Uber
November 29, 2026
Data Scientist
Onsite
Data Manipulation (SQL/Python)
Medium

0

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
cohort analysis
retention
date truncation
distinct counts
CTEs
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. 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 Problems
Sample 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
  1. Build one row per rider per active week (completed trips only).
  2. Cohort week = each rider's first active week.
  3. Join activity back to cohorts and compute week_offset.
  4. Count distinct active...

Submit Your Answer
Markdown supported