Bidgely uses interval energy data to monitor household consumption patterns. A rolling average helps smooth daily variation and supports customer insights in the Bidgely EnergyAI platform.
Write a PostgreSQL query to calculate the rolling average daily energy consumption for each user over a 30-day period.
NULL consumption behavior, and order the results by user and date.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Bidgely user identifier |
| user_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| reading_idPK | INTEGER | Unique energy reading identifier |
| user_id | INTEGER | Referenced Bidgely user identifier |
| reading_date | DATE | Date of the energy measurement |
| consumption_kwh | NUMERIC(10,2) | Energy consumption in kilowatt-hours |