Build a Monthly Prime Signup Cohort Retention Matrix

Last updated: November 29, 2026

Quick Overview

Group Prime members by the month they first signed up and compute, for each of the next twelve months, the share of each cohort that had a paid Prime billing in that month.

Amazon
Data Manipulation (SQL/Python)
Data Scientist
Amazon
November 29, 2026
Data Scientist
Onsite
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Group Prime members by the month they first signed up and compute, for each of the next twelve months, the share of each cohort that had a paid Prime billing in that month.

A core retention question for Amazon subscription businesses such as Prime, where cohort curves feed lifetime value and pricing decisions. The interviewer checks cohort definition, month offset arithmetic, a correct denominator, and how you present the matrix.

What the Interviewer Expects
  • Define the cohort by the first signup month, even for members who churned and rejoined
  • Count retention from paid billing events, not from signup rows
  • Compute month offset with date arithmetic, not by subtracting month numbers
  • Use the full cohort size as the denominator, including members never seen again
  • Pivot to a readable matrix and explain the right-censored triangle
Key Topics to Cover
cohort analysis
retention matrix
DATEDIFF
conditional aggregation
right censoring
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 separate free trial members from members who paid in month zero?
  • How would you show reactivations separately from continuous retention?
  • How would you compare cohorts acquired through Prime Day promotions?
  • How do you avoid counting future cells for young cohorts as zero?
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

Tables:

  • prime_memberships(customer_id, signup_date): one row per signup, so a customer who rejoined appears twice.
  • prime_billing(customer_id, billed_month, status): one row per monthly charge,...
Approach
  1. cohort: first signup month per customer.
  2. activity: distinct customer and month pairs with a PAID charge.
  3. Join and compute month_k as the month difference.
  4. Count distinct retained cus...

Submit Your Answer
Markdown supported