Sub topic 18
Diagnosing wrong totals and empty visuals
This chapter assumes you can build a one-to-many relationship in the Model view and write a basic measure such as SUM. It gives you a repeatable checklist for the case where a visual shows numbers you don't believe, or shows nothing. Nearly every case traces back to one of five causes: a missing relationship, an inactive relationship, the wrong filter direction, unmatched keys, or a many-to-many join.
Start with symptoms
Match what you see to the most likely cause before you open any settings.
| Symptom | Likely cause | First check |
|---|---|---|
| The same value repeats on every row of a table visual | No active relationship between the table that supplies the rows and the table that supplies the measure | Model view: is there a line between the tables, and is it solid? |
| A row labeled (Blank) holds part of the total | Fact rows whose key has no match in the dimension | Compare key values in both tables |
| The visual is completely empty | Key columns never match, or a slicer or filter removes every row | Compare data types and sample values of both keys |
| A slicer on one dimension does not narrow another dimension | Filters only travel from the one side to the many side | Check cross-filter direction |
| Every row shows the same count of dimension members | A many-to-many relationship, or a measure that ignores filters | Check cardinality on the relationship |
| A date-based measure matches the wrong date | The active relationship is not the one you meant | Check which date relationship is active |
| Power BI refuses to create or activate a relationship | An ambiguous path or a circular dependency | Look for two routes between the same pair of tables |
A diagnostic routine
Work through the checks in order. Each one rules out a whole class of causes.
1. Look at the line
Open the Model view and find the two tables. A missing line means no relationship exists, so the dimension cannot filter the fact table. A dashed line means the relationship is inactive. Select the line and read the Properties pane for the columns, cardinality, cross-filter direction, and the "Make this relationship active" setting.
Autodetect only creates relationships when column names and types match. Do not assume a line will exist just because the tables look related.
2. Compare the keys
Select each key column and compare the data type in the Column tools ribbon. A whole number in one table and text in the other will not join. Text keys also fail on invisible differences, such as trailing spaces or different capitalization of codes. Place both keys in a table visual, or open the Data view, and compare real values.
If a relationship refuses to be one-to-many, the "one" side has duplicate or blank keys. Remove the duplicates in Power Query. Do not fall back to many-to-many just to make the error go away.
3. Check the filter direction
With single direction, a filter flows from the one side to the many side. A product slicer filters Sales. A Sales-side condition does not filter the Customer table. If you need customers who bought the selected products, use a measure rather than changing the model for everyone:
Customers Who Bought =
CALCULATE (
DISTINCTCOUNT ( Customer[CustomerKey] ),
CROSSFILTER ( Sales[CustomerKey], Customer[CustomerKey], Both )
)Switching the whole relationship to Both is the heavier option. It can create ambiguous paths and slow queries.
4. Find unmatched keys
When a Sales row has a ProductKey that does not exist in Product, Power BI still counts it in the totals. It groups those rows under a (Blank) member of the Product table. The grand total stays correct, but a category breakdown shows an unexplained blank line.
Measure how many rows are affected. This measure counts Sales rows whose product has no match:
Sales Rows Without Product =
COUNTROWS (
FILTER ( Sales, ISBLANK ( RELATED ( Product[ProductKey] ) ) )
)RELATED returns blank when no matching dimension row exists, so the filter keeps exactly the orphan rows. A result of zero means every key matches. Anything else points you to the source data, where you either add the missing dimension members or correct the keys.
5. Inspect cardinality
A many-to-many relationship (many on both ends) does not require unique keys on either side. Filters then match on every shared value, which can produce results that look right in a total but wrong in a breakdown. A common cause is relating two fact tables directly on a non-unique column such as Region.
The fix is to relate both tables to a shared dimension with unique values, so the filter flows from the dimension in a one-to-many relationship on each side. Where the data truly has many-to-many links, such as customers and accounts, introduce a bridge table that holds one row per valid pair, and relate it one-to-many to each side.
6. Check ambiguity and the active relationship
Power BI allows only one active path between two tables. If two routes exist, one relationship is made inactive, and a measure that relied on it may give surprising results. A typical case is Sales with both OrderDate and ShipDate pointing at the same Date table. Only one stays active, and the other appears as a dashed line.
A measure can activate the dashed relationship for one calculation:
Sales by Ship Date =
CALCULATE (
[Total Sales],
USERELATIONSHIP ( Sales[ShipDate], 'Date'[Date] )
)Put this measure and [Total Sales] side by side on the same Date axis. If the two columns differ the way you expect, both relationships work.
Isolating the problem
Narrow the failing case down before you change anything.
- Build a plain table visual with one dimension column and one simple measure, such as
COUNTROWS ( Sales ). - Add one dimension at a time. The first one that breaks the numbers is the one with the faulty relationship.
- Clear all slicers and visual-level filters, and check the Filters pane for page and report filters.
- If a measure is involved, replace it with a bare
SUMof the fact column. If the plain sum is right, the fault is in your DAX, not in the model.
Common mistakes
- Treating a repeated value as a DAX bug when the tables are simply not connected.
- Changing a relationship to Both and losing the original behavior of other visuals.
- Merging unmatched keys by deleting fact rows, which changes the business totals.
- Creating many-to-many links to avoid cleaning duplicates in a dimension.
Exercise
A table visual shows Category from the Product table next to [Total Sales]. Every category shows the same figure, which equals the grand total. The Model view shows no line between Sales and Product. What is wrong, and what do you do?
Show answer
No relationship exists, so Product cannot filter Sales and each category sees all Sales rows. Create a one-to-many relationship from Product[ProductKey] (one side) to Sales[ProductKey] (many side), with a single cross-filter direction from Product to Sales. Make sure both keys have the same data type and that ProductKey is unique in Product.
Exercise
After you fix the relationship, a (Blank) category holds 4,200 in sales. The grand total is correct. What explains the blank row, and how do you confirm it with DAX?
Show answer
Some Sales rows have a ProductKey that is not in the Product table, so they group under the blank member. Confirm it with a measure such as COUNTROWS ( FILTER ( Sales, ISBLANK ( RELATED ( Product[ProductKey] ) ) ) ), which counts the orphan rows. Then add the missing products to Product or correct the keys in the source.