How would you evaluate the provided dataset if there was an outage in data for a particular column?
Write a SQL query that evaluates the completeness of target_value for every expected reporting date and identifies consecutive dates where the column is effectively unavailable. Include dates with no matching records and distinguish missing column values from missing rows.
report_date, expected_rows, observed_rows, populated_rows, null_target_rows, completeness_pct, row_count_gap, outage_flag, and outage_idreport_date ascending; use NULL for outage_id when no outage exists| Column | Type | Description |
|---|---|---|
| report_datePK | DATE | Expected reporting date |
| expected_rows | INT | Expected number of dataset rows for the date |
| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique dataset record identifier |
| report_date | DATE | Reporting date associated with the record |
| entity_key | VARCHAR(50) | Entity represented by the record |
| target_value | DECIMAL(12,2) | Column being evaluated for an outage |
| loaded_at | TIMESTAMP | Timestamp when the record was loaded |