How do you handle missing or null data points when calculating key performance indicators?
Write a PostgreSQL query that evaluates KPI data for the reporting dates provided. Treat both absent observations and explicit null values as missing. Exclude null values from averages, while retaining KPIs that have no valid observations.
Output
- One row per active KPI, with the KPI name, expected points, observed points, valid points, missing points, average value, completeness percentage, and data status.
- Include all active KPIs, including those with no observations.
- Sort by KPI name ascending.