40 min read

Power BI USERELATIONSHIP for Order Date vs Ship Date in a Lakehouse Model

Model order and ship dates with Power BI USERELATIONSHIP. Validate date roles, inactive relationships, unshipped orders and RLS against expected totals.

Power BI USERELATIONSHIP for Order Date vs Ship Date in a Lakehouse Model

Author: jackey.ye · Updated: 2026-11-25

USERELATIONSHIP activates an existing inactive relationship for the duration of a CALCULATE evaluation, so a measure can filter by ShipDate while the OrderDate relationship stays active. It returns no value of its own. This tutorial covers inactive relationships, date role selection, RLS limits and expected DAX output; for tuning, see the DAX performance optimization guide for lakehouse models. Example configuration — validate in your target environment.

What Does USERELATIONSHIP Do When Order Date and Ship Date Share One Date Table?

USERELATIONSHIP activates an existing inactive relationship for the duration of a CALCULATE evaluation and returns no value itself. Microsoft's USERELATIONSHIP reference states the function "only enables the indicated relationship for the duration of the calculation," and that the active or inactive status of the relationship does not affect how the function uses it.

Three mechanics govern the pattern:

  • One active path per pair of tables. A model can carry only one active filter propagation path between two tables; additional paths must be inactive and are made active only during a calculation. Microsoft documents this in Model relationships in Power BI Desktop.

  • The function overrides unnamed active relationships. Even an inactive relationship is used, and it "overrides any other active relationships that might be present in the model but not mentioned in the function arguments" (USERELATIONSHIP reference).

  • It needs a filter-modifying host. USERELATIONSHIP works only inside functions that take a filter argument, such as CALCULATE, CALCULATETABLE or the OPENINGBALANCE and TOTALYTD family. Used as a standalone expression, it errors.

OrderDate is normally the active role because it is the column most measures and slicers filter on. ShipDate stays inactive until a measure calls it.

How Do You Model One Date Table Against Both OrderDate and ShipDate?

Model one Date dimension with two one-to-many relationships to the fact table: Date[Date] to Sales[OrderDate] (active) and Date[Date] to Sales[ShipDate] (inactive). Both fact columns must share the Date column's data type, and the Date column must hold unique values.

Prerequisites (Example configuration — validate in your target environment.):

  • Power BI Desktop with a semantic model you can edit.

  • A Date table marked as a date table, with one row per date and a unique Date column.

  • A fact table (for example, Sales) containing both an OrderDate and a ShipDate column.

  • Two relationships created from Date[Date] to each fact column, with ShipDate set inactive.

One caveat from Microsoft's relationship documentation: the engine stores DateTime, and a time portion in either column prevents values from matching even when the visible dates look identical. Remove the time portion in Power Query before relating the columns. For tuning the resulting model rather than shaping it, the DAX performance optimization guide covers measurement and attribution.

Which Date Role Should Be Active and Which Inactive?

Make the date role that most measures and slicers use the active one — typically OrderDate, when it is populated for the relevant orders and most reporting filters on it. Microsoft's active vs inactive relationship guidance recommends defining active relationships whenever possible, and notes you can consider inactive relationships when no visual must filter both roles simultaneously and USERELATIONSHIP handles the other role in specific measures.

Decide with three checks:

  1. Population completeness. ShipDate can be BLANK until an order ships; OrderDate normally is not.

  2. Frequency of use. Count how many measures and slicers filter each role; the majority role should be active.

  3. Simultaneous filtering. If one visual must slice by order and ship periods at once, duplicate the Date table so each role has its own active relationship.

How Do You Write the Order-Date and Ship-Date Measures?

Write the base measure against the active OrderDate relationship, then wrap it in CALCULATE with USERELATIONSHIP for the ship-date version. Example configuration — validate in your target environment.

  1. Confirm the active relationship. In Model view, verify DateDate → SalesOrderDate is solid (active) and DateDate → SalesShipDate is dashed (inactive).

  2. Create the base measure using the active relationship:

Orders = COUNTROWS(Sales)
  
  1. Create the ship-date measure following Microsoft's documented pattern, wrapping the base measure in CALCULATE and naming both relationship endpoints:

Orders Shipped =
  CALCULATE(
      COUNTROWS(Sales),
      USERELATIONSHIP('Date'[Date], Sales[ShipDate])
  )
  
  1. Place both measures in a matrix with Date[Year] or Date[Month] on rows.

Expected output: the two measures return different totals per period because they filter different date columns. Rows whose ShipDate is BLANK fall outside every ship-date period, so Orders Shipped excludes them.

What DAX Output Should You Expect in a Matrix?

Expect shipped totals to lag ordered totals, with the earliest and latest periods differing most. The following matrix is illustrative, not observed data from any model:

Year

Orders

Orders Shipped

2023

1,200

1,150

2024

1,340

1,290

2025

980

870

The 2025 gap is widest because recent orders have not shipped yet. The quarter slicer also shows a BLANK option: Microsoft's guidance explains this appears through table expansion, which considers inactive relationships too, so BLANK ship dates surface as an unknown member. Selecting BLANK shows only unshipped orders.

Order-date vs ship-date measures compared

Attribute

Relationship used

Filter column

BLANK handling

Slicer behavior

RLS interaction

What Are the RLS Limitations With Inactive Relationships?

RLS filters propagate only through active relationships, and USERELATIONSHIP cannot be used when row-level security is defined for the table the measure references — it raises an error. Microsoft's active vs inactive guidance states that RLS filters "never propagate for inactive relationships, even when the USERELATIONSHIP DAX function is used by a measure definition," and the USERELATIONSHIP reference documents the error when RLS is defined on the referenced table.

The security reasoning is deliberate. If a measure could swap the active relationship, it could bypass the filter path that RLS relies on and expose rows the role was meant to hide. SQLBI's analysis of the DAX limitations with inactive relationships and RLS describes the resulting error: "The UseRelationship() and CrossFilter() functions may not be used when querying 'Sales' because it is constrained by row-level security."

Workaround with TREATAS. SQLBI shows a measure that removes the active filter with ALL and moves the Date filter onto its delivery-date column (Sales[Delivery Date]); the version below applies the same pattern to Sales[ShipDate]:

Orders Shipped 2 =
  CALCULATE(
      COUNTROWS(Sales),
      ALL('Date'),
      TREATAS(VALUES('Date'[Date]), Sales[ShipDate])
  )
  

Example configuration — validate in your target environment. The caveat is material: SQLBI's example produced incomplete results because the security filter sat on the Date table, which carries two meanings once two relationships exist. Validate that RLS semantics are preserved, or move the security filter onto the fact table. For related filter-propagation patterns, see DAX TREATAS for disconnected slicers in lakehouse semantic models.

When Does Lakehouse Backend Modeling Matter for This Pattern?

Lakehouse backend modeling matters when the storage mode behind the semantic model changes which constraints apply to the relationships — mainly in Fabric Direct Lake. Microsoft's Direct Lake lakehouse documentation lists the constraints a modeler should check:

  • Unique one-side values. One-side columns of relationships must contain unique values, and queries fail if duplicates are detected. A Date table with duplicate dates causes queries to fail; the problem is not confined to a single measure.

  • Matching data types. Table relationships require the data types of related columns to match, so OrderDate and ShipDate must align with the Date column type.

  • Date handling differs by mode. Auto date/time intelligence, which builds relationships using only the date part of a datetime column, is supported in Direct Lake on OneLake but not in Direct Lake on SQL. Marking your own date table and relating on date columns is supported.

  • SQL-based RLS is not applied in Direct Lake on OneLake. When the SQL analytics endpoint enforces row-level security, Direct Lake on OneLake queries succeed but SQL-based RLS is not applied; Direct Lake on SQL applies it unless fallback is disabled. This changes how the RLS section above behaves, so confirm which mode your model uses before relying on either.

A lakehouse backend such as Singdata can perform the upstream data preparation — deduplicating dates and normalizing date columns — that these constraints depend on.

Validation Checklist

Run these checks before publishing. Each item states the check and its pass condition. Example configuration — validate in your target environment.

  1. Relationship states. Open Model view: DateDate → SalesOrderDate is active and DateDate → SalesShipDate is inactive. Pass: exactly one solid line per fact date column.

  2. Data types match. Compare the Date, OrderDate and ShipDate column types. Pass: all three are the same type with no time portion.

  3. Date table marked. Confirm the Date table is marked as a date table. Pass: the table icon shows the date-table marker and Date[Date] is unique.

  4. Measures return different totals. Put Orders and Orders Shipped in a matrix by year. Pass: totals differ and shipped totals lag ordered totals.

  5. BLANK ship dates handled. Filter to unshipped orders. Pass: Orders Shipped returns BLANK or zero for those rows while Orders returns a value.

  6. RLS tested with View As. Use View As on the Modeling ribbon for each role. Pass: rows are filtered as intended and no USERELATIONSHIP error appears.

  7. No USERELATIONSHIP error under RLS. If step 6 errors, confirm whether RLS is defined on the referenced table; if so, apply the TREATAS workaround and re-verify that RLS semantics are preserved.

Frequently Asked Questions

How do I model one Date table against both OrderDate and ShipDate with only one active relationship?

Create two relationships from Date[Date] to the fact table, keep OrderDate active and ShipDate inactive, then activate the ship-date relationship per measure with USERELATIONSHIP inside CALCULATE. Microsoft's active vs inactive guidance recommends this shape when no visual must filter both roles simultaneously.

What exactly does USERELATIONSHIP do and what does it return?

USERELATIONSHIP enables an existing relationship for the duration of the calculation and returns no value; it only works inside filter-modifying functions such as CALCULATE. The Microsoft DAX reference states it "only enables the indicated relationship for the duration of the calculation."

How do I choose which date role is active vs inactive?

Make the role used by most measures and slicers active — usually OrderDate, when it is populated for the relevant orders — and keep the less-used role inactive. Duplicate the Date table if a visual must filter both roles at once, as Microsoft's active vs inactive guidance recommends.

What are the RLS limitations with inactive relationships?

RLS filters propagate only through active relationships, and USERELATIONSHIP errors when RLS is defined on the referenced table. TREATAS is a workaround only if you validate that RLS semantics are preserved, as SQLBI's example of incomplete results shows.

What DAX output should I expect for order-date vs ship-date measures in a matrix?

The Orders and Orders Shipped measures return different totals for the same period because they filter different date columns. Shipped totals typically lag ordered totals, and rows with a BLANK SalesShipDate fall outside every ship-date period, so they appear only under the BLANK slicer option that table expansion produces.

For a related implementation check, see the DAX performance diagnostic guide.

Related Articles