Flag Signup Cohorts Whose Day-Seven Retention Broke From Baseline

Last updated: November 29, 2026

Quick Overview

For daily Instagram signup cohorts, compute Day-7 retention and flag any cohort whose rate falls more than two percentage points below the average of the four previous cohorts from the same weekday, to catch onboarding regressions quickly.

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

0

0

0 solved


For daily Instagram signup cohorts, compute Day-7 retention and flag any cohort whose rate falls more than two percentage points below the average of the four previous cohorts from the same weekday, to catch onboarding regressions quickly.

Instagram's growth team monitors daily cohorts to catch broken onboarding releases within a week, and weekday seasonality is strong. The screen checks a window over aggregated cohort rows, partitioning by weekday so Mondays are compared with Mondays, and requiring a full baseline before flagging.

What the Interviewer Expects
  • Compute D7 per daily cohort first
  • Partition the baseline window by weekday
  • Use only prior cohorts in the baseline (exclude the current row)
  • Require four prior cohorts before flagging
  • Weight or filter tiny cohorts
Key Topics to Cover
window functions
ROWS BETWEEN
seasonality
anomaly detection
cohort monitoring
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 choose between a fixed threshold and a z-score?
  • How would you detect an onboarding regression faster than seven days?
  • How would you avoid alert fatigue across many countries?
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) and daily_active(user_id, ds). Day 7 means active exactly on signup date + 7. Only cohorts with day 7 in the past are evaluated. DAY_OF_WEEK returns 1 to 7....

Approach
  1. Compute cohort size and D7 per signup date. 2. Window by DAY_OF_WEEK(signup_date), ordered by date, over the 4 preceding rows to get the baseline and a count of rows in the window. 3. Flag rows w...

Submit Your Answer
Markdown supported