PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/Meta

Compute SHOP spend share and model performance

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in SQL/Python data manipulation and analytics, focusing on aggregations, joins, time-window computations, handling missing or zero values, and deriving key metrics such as revenue share and revenue-per-conversion.

  • Medium
  • Meta
  • Data Manipulation (SQL/Python)
  • Data Scientist

Compute SHOP spend share and model performance

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

You work on ads measurement. Advertisers can drive users to either **Facebook Shop** (`'SHOP'`) or their own **website** (`'WEBSITE'`). After an ad is shown, you attribute downstream revenue and conversions to the destination. Assume the following tables (all timestamps are in **UTC** and `event_date` is a calendar date): ### Table 1: `ad_revenue` - `event_date` DATE - `advertiser_id` BIGINT - `destination` VARCHAR -- values: `'SHOP'` or `'WEBSITE'` - `revenue_usd` NUMERIC -- attributed revenue in USD ### Table 2: `ad_conversions` - `event_date` DATE - `advertiser_id` BIGINT - `destination` VARCHAR -- values: `'SHOP'` or `'WEBSITE'` - `conversions` BIGINT -- attributed conversion count #### Notes/assumptions - There is at most one row per (`event_date`, `advertiser_id`, `destination`) per table. - “Past 30 days” means the **most recent 30 calendar days including the max `event_date` in the data**. ## Tasks 1) **SHOP share over past 30 days** Write SQL to compute, for each `event_date` in the past 30 days, the share of revenue going to `destination='SHOP'`: Required output columns: - `event_date` - `shop_revenue` - `total_revenue` - `shop_revenue_share` = `shop_revenue / total_revenue` 2) **How does the FB model perform?** Using only these two tables, write SQL to produce a stakeholder-ready daily time series for the past 30 days that helps evaluate performance by destination. At minimum, include: - `event_date` - `destination` - `revenue_usd` - `conversions` - `revenue_per_conversion` = `revenue_usd / NULLIF(conversions, 0)` Also include at least one “share”-style diagnostic (e.g., revenue share or conversion share across destinations) that could indicate whether performance is shifting toward SHOP vs WEBSITE. State any additional assumptions you make (e.g., how to handle missing rows / zero totals).

Quick Answer: This question evaluates proficiency in SQL/Python data manipulation and analytics, focusing on aggregations, joins, time-window computations, handling missing or zero values, and deriving key metrics such as revenue share and revenue-per-conversion.

Related Interview Questions

  • Compute ad impression conversion rates - Meta (medium)
  • Count unconnected posts and reactions - Meta (medium)
  • Count heavy callers in 7 days - Meta (medium)
  • Write SQL for call metrics - Meta (medium)
  • Write SQL for multi-account metrics - Meta (medium)
Meta logo
Meta
Aug 21, 2025, 12:00 AM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
5
0

You work on ads measurement. Advertisers can drive users to either Facebook Shop ('SHOP') or their own website ('WEBSITE'). After an ad is shown, you attribute downstream revenue and conversions to the destination.

Assume the following tables (all timestamps are in UTC and event_date is a calendar date):

Table 1: ad_revenue

  • event_date DATE
  • advertiser_id BIGINT
  • destination VARCHAR -- values: 'SHOP' or 'WEBSITE'
  • revenue_usd NUMERIC -- attributed revenue in USD

Table 2: ad_conversions

  • event_date DATE
  • advertiser_id BIGINT
  • destination VARCHAR -- values: 'SHOP' or 'WEBSITE'
  • conversions BIGINT -- attributed conversion count

Notes/assumptions

  • There is at most one row per ( event_date , advertiser_id , destination ) per table.
  • “Past 30 days” means the most recent 30 calendar days including the max event_date in the data .

Tasks

  1. SHOP share over past 30 days

Write SQL to compute, for each event_date in the past 30 days, the share of revenue going to destination='SHOP':

Required output columns:

  • event_date
  • shop_revenue
  • total_revenue
  • shop_revenue_share = shop_revenue / total_revenue
  1. How does the FB model perform?

Using only these two tables, write SQL to produce a stakeholder-ready daily time series for the past 30 days that helps evaluate performance by destination.

At minimum, include:

  • event_date
  • destination
  • revenue_usd
  • conversions
  • revenue_per_conversion = revenue_usd / NULLIF(conversions, 0)

Also include at least one “share”-style diagnostic (e.g., revenue share or conversion share across destinations) that could indicate whether performance is shifting toward SHOP vs WEBSITE.

State any additional assumptions you make (e.g., how to handle missing rows / zero totals).

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Meta•More Data Scientist•Meta Data Scientist•Meta Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.