Weekly Signup Cohort Retention Triangle for Threads

Last updated: November 29, 2026

Quick Overview

Build a cohort table for Threads where each row is a signup week and columns give the share of that cohort active in week 0 through week 8 after signup, leaving cells blank for weeks that have not happened yet.

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

0

0

0 solved


Build a cohort table for Threads where each row is a signup week and columns give the share of that cohort active in week 0 through week 8 after signup, leaving cells blank for weeks that have not happened yet.

Meta data science onsites often include a product analytics SQL round on a newer app like Threads, where leadership watches cohort curves weekly. The interviewer checks whether you can compute the week offset correctly, pivot into a triangle, and handle immature cells instead of reporting false zeros.

What the Interviewer Expects
  • Compute week offset from signup week, not from calendar week number
  • Deduplicate to one row per user per week before counting
  • Pivot with conditional aggregation
  • Return NULL rather than 0 for cells beyond the data window
  • Keep cohort size as an explicit column
Key Topics to Cover
cohort triangle
DATE_TRUNC
conditional aggregation
right censoring
pivot
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 show the same triangle as absolute users instead of rates?
  • Would you define activity as any open or as posting or replying, and why?
  • How would you detect that the newest cohort is retaining worse than prior ones?
  • How does this change if a user can deactivate and reactivate?
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

threads_users(user_id, signup_date) and threads_activity(user_id, activity_date). Weeks start Monday (DATE_TRUNC('week', ...)). Week 0 is the signup week itself, so it is near 100 percent by con...

Approach
  1. Truncate signup to a cohort week. 2. Turn activity into distinct (user, week) pairs and compute weeks_since = date_diff('week', cohort_week, activity_week). 3. Count distinct users per cohort and...

Submit Your Answer
Markdown supported