Power BI Under the Hood

10 min

Wojciech Szynalski

Power BI Under the Hood, Part 1: Troubleshoot Data Integrity and Relationships with DAX Studio

A Power BI report can show the right grand total and still mislead everyone reading it. Sales can disappear into a blank product category, a perfectly valid relationship can conceal repeated business products, and a date-based measure can quietly use the wrong date. None of those problems is solved reliably by rewriting DAX on instinct. 

This is the first article in our three-part Power BI Under the Hood series. We start with four model issues that typically show up as wrong or unexpected report results: orphaned keys, duplicate business entities, inactive date relationships, and unintended bidirectional filtering. For each case, we use DAX Studio to isolate the symptom, verify its cause, and compare the behavior after a controlled correction. 

The examples come from separate, deliberately modified copies of the Contoso.100K semantic model; the original model was not changed. Where source-level data changes were unavailable, we used calculated objects over the imported data. The screenshots show those lab executions, not production incidents. Tested with DAX Studio 3.5.1, Power BI Desktop 2.152.1279.0 (26.03), and Analysis Services engine 17.0.61.24.


1. When sales disappear into a blank category 

Imagine opening a sales report where the total looks right, but a sizeable amount sits under an empty product category. Before touching the measure, check whether every product key in Sales can actually be found in the product dimension. When the match is missing, the fact rows are still included in the total-but the category has nowhere to put them, so they appear under the model's unknown (Blank) member. 

We can test this directly. EXCEPT finds product keys that appear in Sales but not in the lab's product dimension. TREATAS then measures how many fact rows and how much revenue those keys represent. A RELATED-based check gives us another way to confirm that the relationship cannot resolve those rows: 

We can also ask the storage engine whether it has recorded a referential-integrity violation: 

Here is what we found: the lab product dimension had 2,443 rows, with 74 product keys missing. Those keys accounted for 1,965 sales rows and roughly 2.68 million in Sales Amount. The storage DMV reported RIVIOLATION_COUNT = 1. Yet the grand total remained 210,600,880.8444. That is the key lesson: the total can be right while the category breakdown is wrong. 

In this case, the calculated product dimension excluded Coffee Machines (Subcategory Code 0805), even though Sales still referenced those products. Once we removed the filter and recalculated, the orphan keys, blank-category sales and RI violation disappeared. In a live system, we would also check why the dimension was incomplete upstream rather than treating the calculated-table change as a source fix. 


Figure 1 – Seventy-four unmatched ProductKeys and their Sales impact 

Figure 2 – The repaired key comparison returns no orphans 

But what if every relationship key matches and the numbers still look inflated? The next place to look is the business key-not just the surrogate key used by the relationship.

2. A valid relationship can hide duplicate business entities 

Suppose a staging table loads the same product twice. The relationship can remain valid because each row has a different ProductKey, while the business product identified by Product Code is duplicated. That can distort row counts and average prices without triggering a relationship error. This query groups the staging rows by Product Code and shows which load versions and surrogate keys sit behind each duplicate:

That is exactly what happened here. The staging table contained 2,595 rows, but only 2,517 distinct Product Codes. All 78 duplicated codes belonged to Laptops: 156 staging rows for 78 business products. Because every row had its own ProductKey, the relationship's uniqueness rule had nothing to complain about. The second load carried prices 10% higher, pushing the affected average list price up by a factor of 1.05. 

We deliberately created a second load with the same Product Codes but new surrogate keys. Since this particular staging table is meant to contain one row per product, we kept Load Version = 1. That restored 2,517 rows, 2,517 unique codes and a price ratio of 1.00. Here, the ratio means average Unit Price in staging divided by average Unit Price in Product. Notice that duplicates are not inherently wrong: in a versioned or effective-dated table, multiple rows per business key may be exactly what the model requires. Define the grain first; then decide whether deduplication is appropriate. 


Figure 3 – Repeated Product Codes have separate load versions and surrogate keys 

Figure 4 – Repair summary shows 2,517 staging rows, 2,517 distinct codes and a 1.00 price ratio; the empty duplicate count renders blank 

Once the keys and grain make sense, it is time to ask a different question: is the relationship being used the way the measure's name suggests? 

3. A date label does not activate an inactive relationship 

A measure called ‘Sales by Delivery Date’ sounds unambiguous. But if the model has both Order Date and Delivery Date relationships, the name does not activate the second relationship. Inactive date relationships are often intentional; the measure has to choose one. We compared the lab measure with ordinary order-date sales and with a separate delivery-date calculation using TREATAS. The TREATAS reference fits this lab scenario, although more complicated models can require extra care with filters and grain. 

Across all 119 months, the lab's delivery-date measure matched order-date Sales Amount-not the independent delivery-date reference. The relationship to Delivery Date existed, but it was inactive, and the measure never asked DAX to use it. This is why checking the relationship itself matters before rewriting a calculation. 

The fix was to use USERELATIONSHIP inside CALCULATE for this measure, without changing how other order-date measures work. After the repair, all 119 monthly results matched the independent delivery-date reference, with zero material differences and a maximum absolute difference of zero. The validation query uses + 0 so an empty mismatch count is displayed as 0 rather than BLANK.

Figure 5 – The faulty “delivery date” measure tracks Order Date across the months 

Figure 6 – Repair summary compares 119 months and reports a maximum absolute difference of 0; the empty mismatch count renders blank 

If a date-based KPI looks suspicious, verify which relationship it uses-and test it against a calculation that explicitly follows the intended date role. 

4. Follow a filter that travels farther than expected 

Here is a stranger symptom: select a product category, and the USD–EUR exchange rate changes. So does the number of calendar days. Neither should depend on the product selection in this scenario. Instead of staring at the grand total, we compared both values across product categories to see exactly where the filter was travelling: 

The results made the problem obvious. Across eight categories, the USD–EUR rate ranged from 0.825069 to 0.828946, instead of staying at 0.849851. The calendar showed only 2,799–3,065 days, rather than 4,018. Meanwhile, total Sales Amount still looked fine at 210,600,880.8444. The breakdown revealed what the grand total concealed. 

Following the filter path explains it: Sales[Order Date]–Date[Date] had been switched to BothDirections. That let a Product selection travel through Sales into Date and onward into CurrencyExchange. Restoring single-direction filtering brought the same rate and 4,018 calendar days back to every category. Bidirectional filters have valid use cases; the point is to understand their reach before enabling them.

Wojciech Szynalski

Business Intelligence Developer

Nov 26, 2026

Looking for a trusted partner for your next cloud project?

Reach out to us and tell how we can help