Count Daily Users Active in Both Google Drive and Docs
Last updated: November 29, 2026
Quick Overview
From Workspace product events, compute for each day how many users used both Drive and Docs that day, how many used either, and the overlap share.
0
0
0 solved
From Workspace product events, compute for each day how many users used both Drive and Docs that day, how many used either, and the overlap share.
A short cross-product engagement question in the style of Google online assessments. The interviewer checks that you group at the user-day grain with COUNT(DISTINCT product) rather than self-joining large event tables, and that you define the day in a sensible time zone.
What the Interviewer Expects
- Filter to the two products before grouping
- Group by day and user and count distinct products
- Derive both and either counts from the same grouped table
- Avoid a self-join on raw events
- Choose and state the time zone used for day boundaries
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you extend this to the share of users who used Drive, Docs and Sheets on the same day?
- How would you find whether same-day overlap predicts 30-day retention?
- Why might a self-join version of this query time out?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
workspace_events(user_id, event_ts, product, event_type), with product values like drive, docs, sheets, gmail. Any event counts as use. Days are in Pacific time to match the product dashboar...
Approach
Filter to Drive and Docs and group by (day, user) to get n_products, which is 1 or 2. Then group by day: users with n_products = 2 used both, and every row used at least one. This touches each eve...