Finance Path · Mission 11 of 25Medium

Are we over budget this March?

LEFT JOIN between actuals and budgets with variance math

Back to Finance

The Brief

Mei LinFP&A Managerfpna

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.

You'll practice

JOINsBudget vs actualCASE

Tables available

fact_transactionsfact_budgetsdim_accountsdim_cost_centers

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

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.

Hint 2

LEFT JOIN from actuals to budgets so every CC with spend appears even if budget is missing.

Hint 3

`pct_variance = variance / NULLIF(budget, 0)` — NULLIF prevents a divide-by-zero crash.