Classify Monthly Google Docs Users as New, Retained, Resurrected or Churned

Last updated: November 29, 2026

Quick Overview

Using Google Docs activity events, label every user in every month as new, retained, or resurrected when active, and count users who churned (active last month, inactive this month), producing a monthly growth accounting table.

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

0

0

0 solved


Using Google Docs activity events, label every user in every month as new, retained, or resurrected when active, and count users who churned (active last month, inactive this month), producing a monthly growth accounting table.

Growth accounting is how many Google product teams decompose MAU changes, and Workspace analytics is a natural setting. The onsite interviewer checks that the four states are mutually exclusive, that churn is attributed to the month the user disappeared, and that the identity MAU(m) = MAU(m-1) + new + resurrected - churned holds.

What the Interviewer Expects
  • Define meaningful activity and dedupe to user-month
  • Use LAG to classify active months as new, retained or resurrected
  • Use LEAD to emit churn rows in the month after last activity
  • Exclude the in-progress month from both active and churned counts
  • Validate with the MAU accounting identity
Key Topics to Cover
growth accounting
LAG and LEAD
churn
MAU
window functions
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 a quick ratio and what does it tell you?
  • How would you change the definitions for a weekly table?
  • A user is inactive for one month during a holiday. How do you avoid overstating churn?
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

docs_events(user_id, event_ts, event_type, doc_id). Opening a doc someone shared with you is passive, so I count edit, comment and create as activity. Months are calendar months in UTC. The ou...

Approach

Distinct user-months first. Then for each active month: no previous active month means new; previous active month equals last month means retained; otherwise resurrected. Churn belongs to ...


Submit Your Answer
Markdown supported