LEFT JOIN between actuals and budgets with variance math
Priya's pulling the March board update at 4. I need actual spend vs budget by cost center for March 2025. Columns: `cost_center_name`, `budget`, `actual`, `variance` (actual minus budget), `pct_variance`. OpEx only, posted only.
Each hint you reveal reduces the XP you can earn. Try the query first.
Two subqueries per cost center for March 2025: one summing actuals from fact_transactions (filter OpEx + posted=1), one summing budget_amount from fact_budgets.
LEFT JOIN from actuals to budgets so every CC with spend appears even if budget is missing.
`pct_variance = variance / NULLIF(budget, 0)` — NULLIF prevents a divide-by-zero crash.