You are given user activity data for a mapping product. Write a SQL query to calculate the month-over-month growth rate of active users for a specific platform, using a mapping product as the target product. Treat an active user as a distinct user with at least one activity event in that month. Return each month, the active user count, the prior month's active user count, and the month-over-month growth rate as a percentage. For the first month in the result, the prior month and growth rate should be NULL.
Output details
- Return columns in this order:
month_start, active_users, previous_month_active_users, mom_growth_rate_pct.
- Represent each month as its first calendar day and sort rows by
month_start ascending.
- Exclude activity events whose
event_date is NULL.
- Round
mom_growth_rate_pct to two decimal places.
- Return
NULL for growth when previous_month_active_users is NULL or zero.
- Return
NULL for previous_month_active_users when no immediately preceding calendar month exists.