Marketing Analytics Path · Mission 11 of 25Medium

Which campaign drove the most revenue?

JOIN campaigns with purchases and find top revenue campaign

Back to Marketing Analytics

The Brief

Marcus BellHead of Growthanalytics-help

Can you break down campaign performance for me? I need `campaign_name`, total sends, total opens, and total purchases attributed to each campaign. Sort by purchases descending — I want to see which ones actually drove revenue.

You'll practice

JOINsSUMRefund filtering

Tables available

fact_purchasesdim_campaignsfact_sessions

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

JOIN `fact_purchases` to `dim_campaigns` on `campaign_id` to link purchases to campaigns

Hint 2

Filter refunds with `WHERE p.amount > 0`, then `GROUP BY c.campaign_id, c.campaign_name` and `SUM(p.amount) AS total_revenue`

Hint 3

Use `ORDER BY total_revenue DESC LIMIT 1` to get the single top campaign