Given a table of user login events, write a query to calculate the weekly active users (WAU) and the month-over-month retention rate.
Use calendar weeks beginning on Monday. Define monthly retention as the percentage of users active in the previous calendar month who also logged in during the current calendar month. Exclude events with missing users or timestamps.
metric_type.period_start, weekly_active_users, and mom_retention_rate.period_start.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique identifier for the login event |
| user_id | VARCHAR(50) | Identifier of the user who logged in |
| login_at | TIMESTAMP | Timestamp when the login occurred |