A company wants to monitor daily sign-ups for its debt-relief application funnel. Write a PostgreSQL query that calculates the rolling 30-day average of valid user sign-ups for the reporting period from February 1 through February 5, 2024.
Requirements
- Count each user only once per sign-up date, even if duplicate sign-up events exist.
- Exclude test users and events that are not sign-up events.
- Treat days with no valid sign-ups as zero and calculate the average across the current day and preceding 29 calendar days.
- Return the reporting date, daily sign-ups, and rolling average, ordered chronologically.
Output details
- Return columns named
signup_date, daily_signups, and rolling_30_day_avg in that order.
- Round
rolling_30_day_avg to 2 decimal places.
- Treat missing daily counts as numeric zero.
- Treat both reporting-period boundaries as inclusive.