Build a Monthly Paying Cohort Retention Matrix for Google One

Last updated: November 29, 2026

Quick Overview

From Google One subscription charge records, assign each subscriber to the month of their first successful payment and report, for each cohort and month offset, how many subscribers paid and what percentage of the cohort that is.

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

0

0

0 solved


From Google One subscription charge records, assign each subscriber to the month of their first successful payment and report, for each cohort and month offset, how many subscribers paid and what percentage of the cohort that is.

Google One is a subscription business, so cohort retention by first paid month is a staple of its analytics. Onsite interviewers use this to see whether you define the cohort from clean paying events, compute month offsets correctly, and avoid reporting partial months as churn.

What the Interviewer Expects
  • Define activity as a successful nonzero charge and dedupe to user-month
  • Assign cohort as the first paid month
  • Compute month offset with DATE_DIFF in MONTH units
  • Divide by cohort size taken from month 0
  • Exclude the in-progress month
Key Topics to Cover
cohort analysis
retention
DATE_DIFF
FIRST_VALUE
subscriptions
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
  • Annual plan subscribers pay once a year. How does that distort this matrix and how would you fix it?
  • How would you compute revenue retention instead of user retention?
  • How would you compare cohorts that started on a free trial with those that did not?
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

google_one_charges(user_id, charged_at, amount_usd, status, plan). Refunds and failed retries are separate rows with other statuses. A free trial creates a zero-dollar row, which I exclude so the co...

Approach
  1. Distinct user and paid month.
  2. Cohort month is the minimum paid month per user.
  3. Join back, compute month_number = DATE_DIFF(paid_month, cohort_month, MONTH) and count distinct users per coho...

Submit Your Answer
Markdown supported