Daily spend against sign-ups for one campaign
The task
The growth team is reconciling two sources for the "Family meals video" campaign (campaign_id = 3) in May 2025: the ad platform's daily spend (ad_daily) and the sign-ups credited to it (signups).
The sources do not line up. Some days have spend but no sign-ups, and a sign-up can land on a day the platform has no spend row for.
Return one row for every day from 2025-05-01 to 2025-05-31 that appears in at least one source:
dayspend: that day'sspend, or 0 ifad_dailyhas no rowsignups: number of sign-ups credited to campaign 3 that day (by the UTC date ofsigned_up_at), or 0
Days that appear in neither source are not listed. Sort by day.
Expected output
dayspendsignups- Sorted by day ascending.
- Checked on the sample and on 2 hidden datasets. How grading works
Tables Marketing team · click a name to insert it
campaigns10 rows in the sample
One row per campaign. Key: campaign_id.
| int | Unique id. | |
| text | Name. | |
| text | search, social, video, email or affiliate. | |
| date | First day live. | |
| date | Last day live. NULL if still running. | |
| numeric(10,2) | Budget per day, USD. |
ad_daily969 rows in the sample
One row per campaign per day it served ads. Days with no delivery have no row. Key: campaign_id, day.
| int | The campaign. | |
| date | The day. | |
| int | Times an ad was shown. | |
| int | Clicks. | |
| numeric(10,2) | Money spent, USD. |
signups2,108 rows in the sample
One row per new user. campaign_id is the campaign credited with the sign-up. Key: user_id.
| int | Unique id. | |
| timestamp | When they signed up (UTC). | |
| int | Credited campaign. NULL for organic sign-ups. | |
| text | Two-letter country code. |
purchases2,294 rows in the sample
One row per paid order by a user. Key: purchase_id.
| int | Unique id. | |
| int | Buyer. | |
| timestamp | When (UTC). | |
| numeric(10,2) | Order value, USD. |
Related questions
- Organic sign-ups during each campaign's runmedium
- Sign-ups per campaign who placed a large ordereasy
- Spend and sign-ups per campaign from two sourceshard
- April spend and cost per click for search and socialeasy
- Completed trips for every city and vehicle typemedium
- Invoiced amount by the plan active on the issue datemedium
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL