Streaming Cohorts on the Calendar
Streaming Cohorts on the Calendar
You are analyzing the launch of Vela Stream, a subscription video service. Marketing wants to compare viewers activated on different days, weeks, and months, so every subscriber needs three calendar cohort labels.
The subscriptions table stores the subscription activation timestamp. A weekly cohort starts on Monday, and a monthly cohort starts on the first calendar day of the month. Ignore rows where activated_at IS NULL.
For every subscriber with a known activation time, determine:
- the activation day;
- the Monday of the activation week;
- the first day of the activation month.
Return:
- subscriber_id;
- cohort_day;
- cohort_week;
- cohort_month.
All three cohort columns must be dates displayed as YYYY-MM-DD. Sort by subscriber_id ascending. Return exactly one row per subscriber.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables. Your answer must use the same column names as this sample — alias them with AS if needed.
| subscriber_id | cohort_day | cohort_week | cohort_month |
|---|---|---|---|
| 301 | 2025-12-31 | 2025-12-29 | 2025-12-01 |
| 302 | 2026-01-01 | 2025-12-29 | 2026-01-01 |
| 303 | 2026-01-04 | 2025-12-29 | 2026-01-01 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in