Sub topic 7
Highlighting one number: cards, KPIs and gauges
Some questions have a single answer: "What were sales this quarter?" or "Are we on target?" This chapter covers the three built-in visuals for that job: the card, the KPI and the gauge. It also covers the measures that feed them and the mistakes that make them misleading.
This chapter assumes you can build a basic measure in DAX, place fields in a visual's field wells, and use a date table marked as such in your model. The measures Total Sales, Sales LY and Sales YoY % come from earlier chapters.
When one number is the right answer
A single-value visual works when the reader needs one figure at a glance, and the figure has a clear meaning. Use it for headline totals, for comparisons against a target, or for a status check. It is the wrong choice when the reader needs to see how the number was reached, because it hides the breakdown, the trend and the distribution.
Single-value visuals sit at the top of a report page. A reader sees the headline first, then looks at the bar and line charts below for the explanation.
The card
The card shows one value with a label. It is the simplest visual in Power BI, and most reports use it often.
Power BI has two card visuals:
- Card (new) accepts several fields and shows each as its own card. It can also show a reference label, such as a comparison value, under the main figure.
- Card (classic) shows a single field. It remains available for older reports.
Cards give you a value and nothing else, so put the context in the label or a reference label. "Total Sales" alone leaves the reader asking which period and which region. The slicers and page filters that apply to the card should be visible on the page.
The base measure for a card is a plain aggregation:
Total Sales = SUM ( Sales[SalesAmount] )Dragging a numeric column straight into a card creates an implicit measure. An explicit measure is better because you control its name and format. You can also reuse it in the KPI and gauge.
For a card that shows change from last year, use the percentage measure:
Sales LY =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )Sales YoY % =
DIVIDE ( [Total Sales] - [Sales LY], [Sales LY] )DIVIDE returns blank instead of an error when Sales LY is zero or blank, so the card shows an empty value, not a divide-by-zero error. Format the measure as a percentage in the Measure tools ribbon, and consider a format string such as +0.0%;-0.0% so the sign is always visible.
Cards and text
A card can show text if the measure returns text. This is useful for a status label:
Sales Status =
VAR Att = [Attainment %]
RETURN
SWITCH (
TRUE (),
ISBLANK ( Att ), "No target",
Att >= 1, "On target",
Att >= 0.9, "Near target",
"Behind"
)This measure depends on Attainment %, which is defined in the next section.
The KPI visual
The KPI visual compares a value with a target and shows whether you are ahead or behind. It uses three field wells:
- Value is the indicator, usually a measure such as
Total Sales. - Trend axis is a date or other ordered field. It draws a small area chart behind the number.
- Target goals is the measure the value is compared with.
A target is a measure, not a constant typed into the visual. Create one from a targets table:
Sales Target = SUM ( Targets[TargetAmount] )Attainment % =
DIVIDE ( [Total Sales], [Sales Target] )The KPI shows the difference between value and target as a percentage, and colors it. By default higher is good, so a value above target is green. For a measure where lower is better, such as defect rate or cost, change Direction in the visual's format settings to "Low is good". If you forget this, the colors are inverted and the visual signals the wrong status.
How the KPI picks its number
This is the most common KPI gotcha. When you add a trend axis, the KPI shows the value for the last point on the axis, not the total across all points. With a monthly trend axis, the headline is the most recent month's value. If you wanted the year-to-date total, the KPI shows the wrong number unless the measure itself calculates year to date.
The same rule applies to the target. The target is evaluated at the last axis point too. Check that your value and target measures are on the same grain, such as both monthly or both year-to-date. A monthly value compared with an annual target gives a meaningless result.
Two other behaviors to know:
- If the last point on the axis is blank, the KPI may show a blank or an earlier value. Filter out incomplete periods with a page or visual filter, or the headline reflects a month that is only partly loaded.
- Without a trend axis, the KPI evaluates over whatever filters apply to the page, which works like a card with a target.
The gauge
The gauge draws a value on a semicircular scale. Its field wells are:
- Value, the needle or filled arc.
- Minimum value and Maximum value, the ends of the scale.
- Target value, a marker line on the arc.
A gauge only makes sense when the scale has a real minimum and maximum, such as 0 to 100 percent of capacity, or a quota with a known ceiling. Without those, the scale is arbitrary and the arc fills according to a number the reader cannot interpret.
Gauges have three weaknesses. They use a lot of space for one number. Readers cannot read the exact value from the arc, so you must also show the number as a label. They also cannot show a trend. If those limits matter, use a KPI or a card with a reference label instead.
If you use a gauge, set the minimum and maximum from measures or fixed values, show the data label, and keep one gauge per metric. A row of five gauges takes more space than a table and communicates less.
Choosing between the three
| Need | Best visual | Why |
|---|---|---|
| Headline total with no comparison | Card | Smallest and clearest |
| Several headline numbers side by side | Card (new) | One visual, consistent spacing |
| Value against a target, with recent trend | KPI | Shows status and direction together |
| Progress toward a bounded limit | Gauge | The scale has a meaningful end |
| Exact figures for many items | Table or matrix | A single-value visual shows one number only |
Common mistakes
- No context. A number with no period, unit or comparison cannot be judged. Add a title that names the period and a reference value.
- Wrong color direction. Set Direction in the KPI so that the colors match whether high or low is good.
- Mismatched grain. Compare like with like: monthly value to monthly target.
- Implicit measures. A dragged-in column aggregates by default and renames oddly. Use named measures.
- Too many single-value visuals. A page with twelve cards and gauges is hard to scan. Pick the few numbers that matter and move the rest to a table.
- Gauge on an open-ended metric. If the maximum is a guess, the gauge misleads.
Accessibility and formatting
Do not rely on color alone for status. Red and green look alike to many readers with color vision deficiency. Pair the color with a word or symbol, such as the Sales Status text measure, and keep a high contrast between the number and its background. Set alt text on each visual so a screen reader announces what it shows. Format large numbers with display units, such as thousands or millions, so the card stays readable.
Exercise
A KPI visual has Total Sales as its value, Month as its trend axis and a yearly Sales Target as its target. The value is 80 and the target is 1000, so the KPI shows a large shortfall, but the business is on track. What is the likely cause, and how would you fix it?
Show answer
The KPI evaluates the value at the last month on the trend axis, so it shows one month's sales and compares it with a yearly target. The grain does not match. Fix it by using measures on the same grain, for example a year-to-date sales measure against a year-to-date target, or a monthly target measure against the monthly value.
Exercise
You need to show how close a warehouse is to its storage capacity of 5,000 pallets. Which single-value visual fits, and which field wells would you fill?
Show answer
A gauge fits because the scale has a real maximum. Put the current pallet count in Value, set Minimum value to 0, set Maximum value to 5000, and show the data label so the exact figure is readable. If you also need the recent trend, use a KPI instead.