How would you handle missing or corrupted data fields when preparing an executive-level dashboard?
Write a SQL query that classifies each metric snapshot as usable, missing, or corrupted. Do not silently substitute values for missing or corrupted metrics. Preserve the record for auditability while returning a NULL dashboard value when the metric is not usable.
metric_date, metric_name, dashboard_value, data_status, and quality_issue.metric_date ascending and metric_name ascending.| Column | Type | Description |
|---|---|---|
| snapshot_idPK | INT | Unique metric snapshot identifier |
| metric_date | DATE | Reporting date for the metric |
| metric_name | VARCHAR(100) | Name of the dashboard metric |
| metric_value | NUMERIC(14,4) | Reported numeric value, which may be missing |
| source_system | VARCHAR(100) | System that supplied the metric |
| Column | Type | Description |
|---|---|---|
| quality_flag_idPK | INT | Unique quality flag identifier |
| snapshot_id | INT | Metric snapshot associated with the flag |
| field_name | VARCHAR(100) | Field that was reviewed |
| issue_type | VARCHAR(50) | Quality finding classification |
| issue_detail | VARCHAR(255) | Additional explanation of the finding |