How to calculate Budget Variance
Budget variance is the difference between what you planned to spend or earn and what actually happened.
Formula
Variance = actual − budget; variance % = variance ÷ budget × 100SQL query
This example assumes: budgets(period, category, budget_amount), actuals(period, category, actual_amount). It is written in PostgreSQL syntax; date functions differ slightly in MySQL, BigQuery and SQLite, and your column names will differ from these.
SELECT b.period, b.category,
b.budget_amount,
COALESCE(a.actual_amount, 0) AS actual_amount,
COALESCE(a.actual_amount, 0) - b.budget_amount AS variance,
(COALESCE(a.actual_amount, 0) - b.budget_amount) * 100.0
/ NULLIF(b.budget_amount, 0) AS variance_pct
FROM budgets b
LEFT JOIN actuals a USING (period, category)
ORDER BY ABS(COALESCE(a.actual_amount, 0) - b.budget_amount) DESC;Common mistakes that make Budget Variance wrong
- Sign convention: a positive variance is good for revenue but bad for costs; label it.
- Categories in the budget but missing from actuals need a LEFT JOIN or they disappear.
- Timing differences (annual invoice in one month) are not real overspend.
Ask for Budget Variance in plain English
Instead of writing the query yourself, you can type the question. SchemaChat turns it into SQL against your connected database or uploaded file, runs it, and shows the SQL and the figures it used so you can check the answer before you share it. It does not replace your judgement about the definition: check that the query matches the formula your business uses.
- Which expense categories are most over budget this quarter?
- What is the revenue variance against budget by month?