A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Create a Total Sales measure that sums the order-total column, and then use that measure as the KPI’s indicator.
1. Create the Total Sales measure
In Power BI Desktop:
- In the Data or Report view, right-click your sales table in the Fields/Data pane.
- Select New measure.
- Enter this formula, replacing the table and column names with yours:
Total Sales =
SUM ( Sales[Order Total] )
SUM adds every numeric value in the specified column.^1^ Measures also recalculate according to the report’s filters and slicers.^2^
This is correct when each row represents one order, for example:
| Order ID | Order Total |
|---|---|
| 1001 | 100 |
| 1002 | 250 |
| 1003 | 75 |
The measure returns 425.
If an order appears on multiple rows
If the same complete order total is repeated on every product line, a direct SUM would count that order more than once. Sum one value per order instead:
Total Sales =
SUMX (
VALUES ( Sales[Order ID] ),
CALCULATE ( MAX ( Sales[Order Total] ) )
)
This creates a distinct list of order IDs, takes one order-total value for each order, and adds those values. SUMX evaluates an expression for every row of a table and then returns the sum.^3^
Do not use that pattern if Order Total is actually the value of each individual product line. For line-level data, use:
Total Sales =
SUM ( Sales[Line Total] )
If line total must be calculated from quantity and price, use:
Total Sales =
SUMX (
Sales,
Sales[Quantity] * Sales[Unit Price]
)
2. Add it to a visual
For a simple number without a goal:
- Select the Card visual.
- Drag the new Total Sales measure into the card.
- In Format visual, set the currency, decimal places, and display units.
For a KPI that compares sales with a target:
- Add Total Sales to a temporary chart as the value.
- Add a date field, such as
Calendar[Month], as the trend axis. - Sort the date axis in ascending chronological order before converting the chart; KPI visuals do not provide a sorting option after conversion.
- Select the KPI icon in the Visualizations pane.
- Assign:
- Indicator/Value:
Total Sales - Trend axis: your date or month field
- Target: a sales-target measure or field
- Indicator/Value:
- Open Format visual to configure currency, target label, icons, and whether higher values are better.^4^
A KPI is intended to evaluate a measure against a defined target. If no target or trend is available, a Card is usually the appropriate visual for displaying total sales.
References