Blue Cross and Blue Shield of Kansas needs a daily claims-volume trend for its active plan products. Write a PostgreSQL query that calculates the trailing 30-calendar-day average number of finalized claims for each active plan.
PAID or DENIED; exclude PENDED and VOID claims.plan_code, plan_name, service_date, daily_claim_volume, rolling_30_day_avg.DATE '2025-02-05' as today's date.active_from on or before 2025-02-05 and active_to null or on or after 2025-01-01.plan_code, then ascending by service_date.| Column | Type | Description |
|---|---|---|
| plan_codePK | VARCHAR(20) | Unique plan product identifier |
| plan_name | VARCHAR(100) | Plan product display name |
| active_from | DATE | Product activation date |
| active_to | DATE | Product deactivation date |
| Column | Type | Description |
|---|---|---|
| claim_idPK | INT | Unique claim identifier |
| plan_code | VARCHAR(20) | Associated plan product code |
| service_date | DATE | Date of service |
| status | VARCHAR(20) | Claim adjudication status |