Monthly Cohort Retention for QuickBooks Online Paying Subscribers

Last updated: November 29, 2026

Quick Overview

Using a payments table of subscription charges, write SQL that groups companies by the month of their first successful payment and reports, for each cohort and each month offset, how many companies paid and what share of the cohort that is.

Intuit
Data Manipulation (SQL/Python)
Data Scientist
Intuit
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Using a payments table of subscription charges, write SQL that groups companies by the month of their first successful payment and reports, for each cohort and each month offset, how many companies paid and what share of the cohort that is.

QuickBooks Online is a subscription business, so paid retention by cohort is a metric Intuit analysts and data scientists build constantly. The interviewer looks for correct cohort assignment, month arithmetic that crosses year boundaries, and a denominator taken from the full cohort rather than survivors.

What the Interviewer Expects
  • Define the cohort as the first successful payment month, excluding failed or refunded charges
  • Compute month offsets that work across year boundaries
  • Count distinct companies so multiple charges in a month count once
  • Use the cohort size as the denominator
  • Mention right-censoring for recent cohorts
Key Topics to Cover
cohort analysis
retention
date arithmetic
CTEs
COUNT DISTINCT
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 compute revenue retention (net dollar retention) instead of logo retention?
  • A company pauses for two months and returns. How does that show up and is it what the business wants?
  • How would you separate retention by plan tier (Simple Start, Essentials, Plus, Advanced)?
  • How would you present this to leadership to compare the latest pricing change?
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

payments(company_id, paid_at timestamp, amount_cents, status) with status in (succeeded, failed, refunded). I treat a company as retained in a month if it has at least one succeeded charge tha...

Approach
  1. Filter to succeeded charges and truncate to month.
  2. Cohort month per company with MIN.
  3. Month offset: (year diff) * 12 + (month diff), which is safe across December to January.
  4. Count dis...

Submit Your Answer
Markdown supported