Short answer: every KPI needs five measures: Actual, Target, Variance (Actual - Target), Variance % (DIVIDE ( Variance, Target )) and Status (on target or not, aware of whether higher or lower is better). Targets usually come per month and region, coarser than the facts: keep them in their own table and apply the report's filters to it with TREATAS, so the target follows slicers without a many-to-many relationship. Year to date works the same with DATESYTD on both.
Get this pattern right once and every KPI page (sales, costs, OTIF, churn) reuses it.
What do the measures return?
| Month | Actual | Target | Variance | Variance % | Status |
|---|---|---|---|---|---|
| Jan | 212 | 200 | +12 | +6.0% | On target |
| Feb | 188 | 200 | -12 | -6.0% | Below |
| Mar | 236 | 220 | +16 | +7.3% | On target |
| Apr | 205 | 220 | -15 | -6.8% | Below |
| Total | 841 | 840 | +1 | +0.1% | On target |
- Actual
- Target
How do you write them?
Actual = SUM ( Sales[Amount] )
Target =
CALCULATE (
SUM ( Targets[Amount] ),
TREATAS ( VALUES ( 'Date'[Year Month] ), Targets[Year Month] ),
TREATAS ( VALUES ( Region[Region] ), Targets[Region] )
)
Variance = [Actual] - [Target]
Variance % = DIVIDE ( [Variance], [Target] )
Attainment % = DIVIDE ( [Actual], [Target] )
Status =
SWITCH (
TRUE (),
ISBLANK ( [Target] ), BLANK (),
[Actual] >= [Target], "On target",
[Attainment %] >= 0.95, "Close",
"Below"
)The Targets table has one row per Year Month and Region. TREATAS passes the selected months and regions from the report to it. If targets have a column the facts do not (a product line, say), add a third TREATAS from that dimension.
What if the report shows days or weeks?
A monthly target shown per day must be split. The simplest is even by day:
Target (daily) =
SUMX (
VALUES ( 'Date'[Date] ),
VAR M = CALCULATE ( SELECTEDVALUE ( 'Date'[Year Month] ) )
VAR DaysInMonth = CALCULATE ( COUNTROWS ( 'Date' ), ALL ( 'Date' ), 'Date'[Year Month] = M )
RETURN DIVIDE ( CALCULATE ( [Target] ), DaysInMonth )
)For seasonal businesses, weight by working days or by last year's daily share instead of even days.
How do you compare year to date?
Actual YTD = CALCULATE ( [Actual], DATESYTD ( 'Date'[Date] ) )
Target YTD = CALCULATE ( [Target], DATESYTD ( 'Date'[Date] ) )
Variance YTD % = DIVIDE ( [Actual YTD] - [Target YTD], [Target YTD] )
-- the full-year target, for "how far are we"
Target FY = CALCULATE ( [Target], ALL ( 'Date' ), VALUES ( 'Date'[Year] ) )Mid-year, compare YTD actual with YTD target, not with the full-year target. See YTD, QTD and MTD.
What if lower is better?
For costs, defects, churn or delivery days, below target is good. Put the direction in one place:
Cost Variance % = DIVIDE ( [Cost] - [Cost Target], [Cost Target] )
Cost Status = IF ( [Cost] <= [Cost Target], "On target", "Over" )
-- a "good is positive" variance for colouring all KPIs alike
Cost Variance Good = -[Cost Variance %]The KPI visual has a direction under Trend axis (high is good or low is good) for the same reason.
How do you show it?
- Table or matrix: Variance % with conditional formatting (green above 0, red below), or an icon from Status.
- KPI visual: Actual as value, Month as trend axis, Target as target.
- Combo chart: Actual as columns, Target as a line (above).
- Bullet-style bar: bars of Actual with a target marker, as a custom visual.
What goes wrong?
- A relationship from Targets to Date by month. The Date table has many rows per month, so it becomes many-to-many;
TREATASor a Month dimension avoids it. - Target totals by summing the wrong grain. If targets repeat per product,
SUMdoubles them; store targets at one grain. - Variance % on tiny targets. +400% on a target of 1 dominates the colours; show variance in amounts too.
- Mixed directions. Green for "up" on costs is red in reality; handle direction per KPI.
Where can you check this?
- Microsoft Learn: TREATAS function (DAX)
- Microsoft Learn: Create key performance indicator (KPI) visualizations
- Microsoft Learn: DIVIDE function (DAX)
Where do you start?
Load your targets as a table at month and region grain and add the five measures. Then budget variance applies the same pattern to costs.