Sales scorecard: on track, at risk or behind budget with SWITCH(TRUE())
Turn budget attainment into a scorecard status for every month and category, and keep empty periods blank.
You will learn to
- Classify a KPI into status bands with SWITCH(TRUE())
- Order the conditions from the strictest to the loosest
- Return blank where there is nothing to score
How it works
A **scorecard** turns a KPI into a word people can scan: green, amber, red. It starts from **attainment**, actual ÷ budget, where 100% is exactly on budget. The model already has `[Budget Attainment %]`: it divides `[Total Sales]` by `[Total Budget]` (which reaches the Budget table through `TREATAS`) and stays blank on product rows, where no budget exists. In 2025 it swings from 58% in January to 119% in June.
Then classify it with `SWITCH(TRUE(), condition1, result1, condition2, result2, …, else)`. The conditions are checked in order and the first TRUE one wins, so go from best to worst: at least 100% is "On track", at least 90% is "At risk", anything else is "Behind".
Order also matters for the empty case. A month outside the selected year has no attainment (blank), and `blank >= 0.9` is FALSE, so without a first check it would fall through to "Behind". Test `ISBLANK` first and return `BLANK()`.
Practice it hands-on with a real data model and a live report that updates as you type.
Discount Flag =
VAR rate = DIVIDE([Gross Sales] - [Total Sales], [Gross Sales])
RETURN SWITCH(TRUE(), ISBLANK(rate), BLANK(), rate > 0.05, "High", "Normal")