Write a query using SQL window functions to calculate running 30-day active user retention cohorts across different subscription tiers.
Use the provided users, subscriptions, and activity_events tables. Treat each user's signup month as the cohort, use the non-ended subscription at signup, and evaluate activity during signup day through day 30.
Output
- One row per subscription tier, signup cohort month, and checkpoint day 0, 7, 14, 21, 28, or 30.
- Return
tier, cohort_month, days_since_signup, cohort_size, running_active_users, and retention_rate_pct.
- Include cohorts with no qualifying activity, order by
tier, cohort_month, and days_since_signup.