← Meta Interview Insights

Meta·Data Scientist·Technical Phone Screen·Senior

Senior
May 2026

Summary

Meta Data Scientist interview, technical round focused on SQL window functions and revenue forecasting. The question was more involved than it looked on the surface, mixing rolling aggregations with YoY math and then a projection step at the end.

Questions Asked (1)

Q1

Given a table with daily ad revenue, compute a 30-day rolling sum for every calendar day, then calculate the year-over-year percentage change for each day based on that rolling sum. Using the most recent YoY% figure, project total revenue for the next full calendar year.

Product Analytics & MetricsAlgorithms & Data StructuresPricing & Monetization
Author's notes

Three parts and I only really nailed the first one cleanly.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data schema and assumptions, then outline the SQL or pandas steps to compute the 30-day rolling sum and YoY percentage change. Finally, explain how you would use the most recent YoY% to project next year's revenue, discussing any caveats or validation checks.

Pro tip: Mention that you would validate the rolling sum by checking edge cases (e.g., first 29 days) and ensure the YoY calculation accounts for leap years and missing data. Also, highlight that projecting a full year from a single YoY% assumes seasonality is stable, so you might adjust for known seasonal patterns.

1. Clarify requirements and data

Confirm the table structure (date, revenue), define 'daily ad revenue', and specify the rolling window (30 days) and YoY calculation (same day previous year). Ask about data completeness and time zone.

2. Compute 30-day rolling sum

Use a window function (e.g., SUM(revenue) OVER (ORDER BY date ROWS BETWEEN 29 PRECEDING AND CURRENT ROW)) to calculate the rolling sum for each day. Handle initial days with insufficient data appropriately.

3. Calculate YoY percentage change

For each day, compute the percentage change between the current rolling sum and the rolling sum from the same day in the previous year. Use a self-join or LAG with date offset, ensuring alignment by date.

4. Project next year's revenue

Take the most recent YoY% (e.g., yesterday's or today's) and apply it to the corresponding day's revenue from the previous year to estimate next year's daily revenue. Sum these estimates over the next 365 days to get total projected revenue.

5. Validate and discuss assumptions

Check for outliers, missing data, and seasonality. Discuss limitations of using a single YoY% for projection and suggest alternative methods (e.g., time series forecasting) if needed.

Key Points to Mention

  • Window functions for rolling sums (SQL: ROWS BETWEEN; pandas: rolling().sum())
  • Handling missing dates or incomplete data (e.g., forward-fill or exclude)
  • YoY calculation: (current - previous) / previous * 100, ensuring date alignment (e.g., same day last year, accounting for leap years)
  • Projection method: apply most recent YoY% to last year's daily revenue and sum over next year
  • Assumptions: stable seasonality, no major market changes, and that the most recent YoY% is representative
  • Validation: backtesting the projection method on historical data, checking for anomalies

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.