Measure totals
A total is another evaluation of the measure
In a standard Power BI matrix, a measure at a total cell is evaluated using that cell's context, not automatically by adding all visible values. Additive revenue often gives the same result either way; distinct counts, means and ratios may not. Use the five-line retail model with unmodified default total behavior, no custom totals, no visual calculations, and no hidden filters. Ask what the metric means at each grain before deciding a total is wrong.
Example 1 — distinct orders and average line value
Create each measure separately:
Context Orders = DISTINCTCOUNT(FactSales[OrderID])Context Average Line =AVERAGEX(FactSales, FactSales[Quantity] * FactSales[UnitPriceUSD])With product on rows, the order counts are Notebook 2 (O01, O02), Desk Lamp 2 (O01, O04), Backpack 1 (O03). The grand total is 4 because O01 occurs in two products. Adding 2 + 2 + 1 counts O01 twice. The product counts answer a different question than the total.
With region on rows instead, average line revenue is North 104/3 (approximately 34.67), South 96/2 = 48.00, and grand total 200/5 = 40.00 USD per line. Averaging the two displayed regional means gives about 41.33, which weights regions equally, not lines. AVERAGEX evaluates an expression for each input row and averages its numeric results; these rows have no missing amounts.
Example 2 — ratio of totals, not total of ratios
Create each measure separately:
Context Profit = SUM(FactSales[RevenueUSD]) - SUM(FactSales[CostUSD])Context Margin = DIVIDE([Context Profit], [Context Revenue])| Region | Revenue USD | Profit USD | Margin |
|---|---|---|---|
| North | 104 | 38 | 36.54% |
| South | 96 | 36 | 37.50% |
| Total | 200 | 74 | 37.00% |
The total ratio is 74/200, not 74.04% (sum of rounded percentages) or 37.02% (unweighted average of the two ratios, rounded). Percentage formatting changes presentation, not the measure value. With an empty denominator, DIVIDE returns BLANK by default. Keep missing and zero distinct; a separate business requirement may justify another definition.
Check the model with a DAX query
A DAX query returns a table rather than creating a measure. In a disposable Desktop model where the named measures already exist, run the following in DAX Query View (each fenced query is a separate request):
EVALUATESUMMARIZECOLUMNS( DimRegion[Region], "Revenue USD", [Context Revenue], "Profit USD", [Context Profit], "Margin", [Context Margin], "Average line USD", [Context Average Line])ORDER BY DimRegion[Region]SUMMARIZECOLUMNS groups by the region column and evaluates the named scalar expressions per group. It can suppress groups whose expressions all return BLANK. Compare the two expected regional rows above, not a screenshot. For an independent unfiltered total, run:
EVALUATEROW("Revenue USD", [Context Revenue], "Orders", [Context Orders], "Profit USD", [Context Profit], "Margin", [Context Margin], "Average line USD", [Context Average Line])ROW constructs a one-row result. Expected values are 200, 4, 74, 0.37 and 40. These queries are static and native execution is NOT RUN. They do not inherit slicer selections from the report. Verify the exact model and query result before relying on them. Detailed query modifiers and context transition belong to later chapters.
Practice — defend the total
Predict the distinct orders for North alone and for North + Notebook. Predict North and South profit and margin before formatting; then explain why the grand total of product order counts is not 5. If a stakeholder requests the average regional margin, define it as a separate metric rather than silently changing the meaning of gross margin. Record expected and actual outputs separately.