Can you explain how conditional formatting can be applied programmatically to highlight critical variances in a dataset?
For this SQL implementation, return each target metric with its actual value, variance, percentage variance, and a status label based on the configured threshold. Include missing targets or actuals and handle zero targets explicitly.
metric_name, period, target_value, actual_value, critical_threshold_pct, variance_value, variance_pct, and formatting_statusmetric_name, then period| Column | Type | Description |
|---|---|---|
| target_idPK | INT | Unique target record identifier |
| metric_name | VARCHAR(100) | Metric being monitored |
| period | DATE | Reporting period |
| target_value | NUMERIC(12,2) | Expected metric value |
| critical_threshold_pct | NUMERIC(6,4) | Critical variance threshold as a decimal fraction |
| Column | Type | Description |
|---|---|---|
| actual_idPK | INT | Unique actual record identifier |
| metric_name | VARCHAR(100) | Observed metric name |
| period | DATE | Observed reporting period |
| actual_value | NUMERIC(12,2) | Observed metric value |