Weekly Signup Cohorts and Day-Seven Retention for Microsoft Teams

Last updated: November 29, 2026

Quick Overview

Using a users table with signup dates and a daily activity table, write SQL that groups new Teams users into weekly signup cohorts and reports, for each cohort, the share who came back at least once during days 1 to 7 after signup.

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

0

0

0 solved


Using a users table with signup dates and a daily activity table, write SQL that groups new Teams users into weekly signup cohorts and reports, for each cohort, the share who came back at least once during days 1 to 7 after signup.

A SQL screen in the style of Microsoft's product data science interviews for Teams and other Microsoft 365 apps, where early retention is a core health metric. The interviewer checks that you define the retention window precisely, keep users with zero activity in the denominator, and exclude cohorts that have not had seven days to mature.

What the Interviewer Expects
  • State the retention definition and the cohort week convention before writing SQL
  • Keep every signup in the denominator with a LEFT JOIN
  • Deduplicate users with multiple active days in the window
  • Exclude day 0 so the signup session does not count as a return
  • Drop cohorts whose 7-day window is not yet complete
Key Topics to Cover
cohort analysis
retention
LEFT JOIN
date arithmetic
SQL
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 produce a full retention triangle for days 1 through 30?
  • How would you change the query if activity lived in a raw event table with billions of rows?
  • How would you separate retention for users invited by a colleague versus self-signups?
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

users(user_id, signup_date) has one row per user. activity(user_id, activity_date) has one row per user per active day, though I would not assume it is free of duplicates. Questions to settle: is ...

Approach

Assign each user a cohort week by truncating the signup date. Find the set of users with at least one active day between signup + 1 and signup + 7, using DISTINCT so users with several active days c...


Submit Your Answer
Markdown supported