WhatsApp Cohort Retention Using Each User's Local Calendar Day

Last updated: November 29, 2026

Quick Overview

WhatsApp events are logged in UTC, but retention should use the user's local day. Using a users table with a timezone name, build Day-1 and Day-7 retention per local signup date and report how many users change cohort compared with the UTC version.

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

0

0

0 solved


WhatsApp events are logged in UTC, but retention should use the user's local day. Using a users table with a timezone name, build Day-1 and Day-7 retention per local signup date and report how many users change cohort compared with the UTC version.

WhatsApp's user base is spread across every timezone, so UTC day boundaries split a single evening session in India or Brazil across two days. Data engineering screens at Meta use this to check timestamp conversion, consistency between signup and activity conversion, and awareness of daylight saving changes.

What the Interviewer Expects
  • Convert both signup and activity timestamps with the same timezone
  • Use named zones rather than fixed offsets so DST is handled
  • Recompute distinct active days after conversion
  • Quantify the impact versus the UTC definition
  • Discuss what happens when a user's timezone changes
Key Topics to Cover
timezones
AT TIME ZONE
daylight saving
cohort definition
data pipelines
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 store timezone history if users travel?
  • Which pipeline layer should own the local-date column?
  • How would you backfill this for two years of data efficiently?
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_ts_utc, tz) with tz such as 'Asia/Kolkata'; events(user_id, event_ts_utc). Missing timezones fall back to UTC. Engine is Presto/Trino, which supports AT TIME ZONE with na...

Approach

Convert timestamps to local time and cast to DATE in a CTE so every later step works on local days. Compute D1 and D7 with LEFT JOINs to distinct local active days. Separately, compare each user's loc...


Submit Your Answer
Markdown supported