Your question is 30-Day Rolling Conversion SQL. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
@Orchard Marketing Analytics needs to monitor how conversion performance changes across acquisition channels. Write a PostgreSQL query that calculates each channel's daily conversion rate and its 30-day rolling average.
NULL when visits are zero.NULL daily rates when calculating the rolling average, and round both rates to four decimal places.| Column | Type | Description |
|---|---|---|
| performance_idPK | INTEGER | Unique performance record identifier |
| channel | VARCHAR(50) | @Orchard acquisition channel |
| activity_date | DATE | Date associated with the performance record |
| visits | INTEGER | Number of attributed visits |
| conversions | INTEGER | Number of completed conversions |