Sub topic 10
Pitfalls: blank dates, wrong columns, and unexpected totals
This chapter assumes you have a star schema with a Sales fact table and a Date dimension. It also assumes you can write a measure with CALCULATE and that you know Sales[OrderDate] has the active relationship to 'Date'[Date] while Sales[ShipDate] has an inactive one. The three problems below come up most often when you use USERELATIONSHIP.
Pitfall 1: Blank or missing dates
A blank result usually means the filter reached the fact table but matched no rows. Common causes:
- Unshipped orders. Orders that have not shipped have a blank or null ShipDate. These rows never match a row in the Date table, so they drop out of any ship-date measure. The measure is correct, and the total is lower than the order-date total.
- Dates outside the Date table range. If Sales[ShipDate] holds a value the Date table does not cover, that row is attached to a blank row in the Date table and no date filter selects it. Make sure the Date table spans every date in every date column.
- Placeholder dates. Values such as 1900-01-01 or 9999-12-31 stand in for "no date". They fall outside the Date table range and cause the same loss.
- Time portions. If ShipDate is a date and time, such as 2026-03-05 14:30, it does not equal the whole date 2026-03-05 in the Date table. Convert the column to a date, or store the time separately.
To check, compare row counts with a simple measure:
Unmatched Ship Rows =
COUNTROWS (
FILTER (
Sales,
ISBLANK ( Sales[ShipDate] )
|| NOT ( Sales[ShipDate] IN VALUES ( 'Date'[Date] ) )
)
)Note that the VALUES call here is evaluated in the current filter context, so use this measure with no date filter applied.
Pitfall 2: Wrong columns in USERELATIONSHIP
USERELATIONSHIP takes two column references, and they must match an existing relationship in the model. It does not create a relationship.
-- Fails: no relationship exists between these two columns
Sales Amount Bad =
CALCULATE (
[Sales Amount],
USERELATIONSHIP ( Sales[DueDate], 'Date'[Date] )
)If the model has no relationship between Sales[DueDate] and 'Date'[Date], this measure returns an error. Other mistakes that cause the same error:
- Using the active relationship's columns. The active one is already in use, and the call adds nothing.
- Using a column from a different date table, such as a duplicated 'Ship Date' table, when the relationship is on 'Date'.
- Passing a column from the Date table that is not the one on the relationship, for example 'Date'[Year] instead of 'Date'[Date].
The fix is to open the model view and confirm the exact column pair, including which table each relationship connects. An inactive relationship appears as a dashed line.
Pitfall 3: Unexpected totals
Totals can look wrong in two ways.
Mixed roles in one visual. If a visual shows 'Date'[Year] on rows with both [Sales Amount] and [Sales Amount by Ship Date], each column filters by a different date. Their grand totals can still match, but the yearly values differ, because an order placed in December may ship in January. Label measures by role so the reader knows which date applies.
Filters from other places. USERELATIONSHIP changes which relationship the Date table uses. It does not remove other filters. A slicer on the Date table, a slicer on Sales[OrderDate], or a filter on another dimension still applies. Combining an order-date slicer with a ship-date measure often produces a result that is neither one.
The diagram shows how one slicer selection reaches the fact table through different relationships.
Quick troubleshooting table
| Symptom | Likely cause | Check |
|---|---|---|
| Error in the measure | Column pair has no relationship | Model view, dashed line between the two columns |
| Ship-date total lower than order-date total | Blank ShipDate for unshipped orders | Count rows with a blank ShipDate |
| Rows missing for some dates | Date table range too short | Min and max of every date column |
| Numbers match order date | Relationship not activated | Look for USERELATIONSHIP inside CALCULATE |
Exercise
Your measure [Sales Amount by Ship Date] returns 4.2 million for all dates, while [Sales Amount] returns 4.5 million. The Date table covers every year in the data. What is the most likely cause, and how do you confirm it?
Show answer
Some rows probably have a blank ShipDate, because the orders have not shipped, so they match no Date row and drop out of the ship-date measure. Confirm it by counting Sales rows where ShipDate is blank, or by using the Unmatched Ship Rows measure. The rows' SalesAmount should add up to about 0.3 million.