Power BI Exercise - Using an Inactive Date Relationship with USERELATIONSHIP
Power BI Exercise - Using an Inactive Date Relationship with USERELATIONSHIP
Analyse the same retail transactions by sale date or ship date.
In this guided exercise, you will add a synthetic ShipDate column to the retail dataset, connect it to the existing Date table with an inactive relationship, and create measures that temporarily activate the shipping-date path.
USERELATIONSHIP changes the date path used by a calculation.
Why use two date relationships?
A transaction can contain several dates. In this exercise:
- SaleDate represents when the sale was recorded.
- ShipDate represents when the item was shipped.
Both columns need calendar information from the same Date table. However, Power BI permits only one active filter path between these two tables at a time. SaleDate remains the default active relationship; ShipDate becomes inactive and is used only by selected measures.
Solid line = active default path. Dashed line = inactive path activated only by a measure.
Before you begin
Use the completed retail star-schema model. Confirm that:
- The Date table spans the complete 2026 calendar year.
Date[Date]has an active one-to-many relationship toSales[SaleDate].[Total Sales]returns 21,788 with no filters.
Step 1: Create the ShipDate calculated column
- Open Data view and select the Sales table.
- Select New column.
- Enter the following formula.
ShipDate =
Sales[SaleDate]
+ MOD ( Sales[SaleID], 3 )
+ 1
The formula adds between one and three days to each SaleDate. It creates predictable synthetic shipping dates for this learning exercise.
Step 2: Verify sample shipping dates
| SaleID | SaleDate | Expected ShipDate |
|---|---|---|
| 1001 | 3 Jan 2026 | 6 Jan 2026 |
| 1002 | 4 Jan 2026 | 5 Jan 2026 |
| 1008 | 17 Jan 2026 | 18 Jan 2026 |
| 1013 | 28 Jan 2026 | 31 Jan 2026 |
| 1015 | 31 Jan 2026 | 2 Feb 2026 |
Step 3: Create the inactive relationship
- Open Model view.
- Drag
Date[Date]ontoSales[ShipDate]. - Set cardinality to One to many (1:*).
- Set cross-filter direction to Single.
- Clear Make this relationship active.
- Select OK.
The new ShipDate relationship should appear as a dashed line. The existing SaleDate relationship remains solid and active.
Step 4: Observe the default active relationship
Create a table containing Date[Year Month] and [Total Sales]. Because the SaleDate relationship is active, the result is grouped by the date of sale:
| Year Month | Total Sales by SaleDate |
|---|---|
| 2026-01 | 21,788 |
Step 5: Create Sales by Ship Date
Sales by Ship Date =
CALCULATE (
[Total Sales],
USERELATIONSHIP (
Sales[ShipDate],
'Date'[Date]
)
)
For this measure only, USERELATIONSHIP activates the ShipDate relationship and overrides the competing active SaleDate relationship.
Step 6: Create Transactions Shipped
Transactions Shipped =
CALCULATE (
[Transaction Count],
USERELATIONSHIP (
Sales[ShipDate],
'Date'[Date]
)
)
Step 7: Compare monthly results
Add Date[Year Month], [Total Sales], [Sales by Ship Date], and [Transactions Shipped] to a Table visual.
| Year Month | Sales by SaleDate | Sales by ShipDate | Transactions shipped |
|---|---|---|---|
| 2026-01 | 21,788 | 21,236 | 14 |
| 2026-02 | Blank | 552 | 1 |
| Total | 21,788 | 21,788 | 15 |
The Fast Charger was sold on 31 January but shipped on 2 February. The same transaction therefore contributes to January sales and February shipped sales.
Step 8: Validate in DAX Query View
EVALUATE
FILTER (
SUMMARIZECOLUMNS (
'Date'[Year Month],
"Sales by SaleDate", [Total Sales],
"Sales by ShipDate", [Sales by Ship Date],
"Transactions Shipped", [Transactions Shipped]
),
NOT ISBLANK ( [Sales by SaleDate] )
|| NOT ISBLANK ( [Sales by ShipDate] )
)
ORDER BY 'Date'[Year Month]
The query should return January and February with the control values shown above.
Step 9: Create a daily comparison chart
- Add a Line chart.
- Place
Date[Date]on the X-axis. - Add
[Total Sales]and[Sales by Ship Date]to the Y-axis. - Set the title to Sales Recorded versus Sales Shipped.
- Restrict the displayed range to January and February 2026.
The two lines show the same transaction values on different dates.
Step 10: Test a date slicer
- Add a slicer using
Date[Year Month]. - Select 2026-02.
- Confirm
[Total Sales]is blank because no sales were recorded in February. - Confirm
[Sales by Ship Date]is 552 because one January sale shipped in February.
When should this pattern be used?
An inactive relationship is suitable when one date role is the normal reporting path and only selected measures need the alternative role. If report users must filter and compare Sale Date and Ship Date independently at the same time, create separate role-playing date tables with active relationships instead.
USERELATIONSHIP can make an inactive relationship carry an RLS filter.Knowledge check
- Why is the SaleDate relationship active?
- Why must the ShipDate relationship be inactive?
- What does USERELATIONSHIP change during measure evaluation?
- Why does February contain shipped sales but no recorded sales?
- When would two separate Date tables be preferable?
Troubleshooting
| Problem | What to check |
|---|---|
| Power BI refuses to activate the ShipDate relationship. | This is expected. Keep SaleDate active and ShipDate inactive. |
| Sales by Ship Date matches Total Sales on every daily row. | Confirm USERELATIONSHIP references Sales[ShipDate] and Date[Date]. |
| February does not appear. | Confirm the Date table includes the complete 2026 year and the visual/query includes Sales by Ship Date. |
| The measure reports that the columns are not part of a relationship. | Create the inactive ShipDate relationship before creating or running the measure. |
| The relationship line is solid. | Edit the ShipDate relationship and clear Make this relationship active. |
Exercise complete
- ShipDate contains synthetic dates one to three days after SaleDate.
- SaleDate has the active relationship.
- ShipDate has the inactive dashed relationship.
- January shipped sales equal 21,236.
- February shipped sales equal 552.
- Total shipped sales still equal 21,788.