skip to content

In Power BI, how do you model both order date and ship date against one Date table?

level: middleimportance: nice to knowfreq 42%

answer

  1. only one path may be live at a time
  2. the second line is dashed for a reason
  3. a measure can borrow the other relationship
  4. or give each role its own table
  5. discoverability versus model size

basics

~20 s

Only one relationship between two tables can be active, so the second date relationship is created inactive. Either activate it per measure with USERELATIONSHIP, or load a second, separately named date table so users can slice by each role directly.

solid answer

~50 s

A `Date` table related to both `Sales[OrderDate]` and `Sales[ShipDate]` is a **role-playing dimension**. Power BI permits only one active relationship path between two tables, so the second is created **inactive** — drawn as a dashed line and ignored by ordinary filter propagation. Two solutions exist. First, keep one date table and write role-specific measures that activate the inactive relationship inside `CALCULATE` with `USERELATIONSHIP`, giving you `Sales Ordered` and `Sales Shipped` side by side under one date slicer. Second, load the date table twice with distinct names — `Order Date` and `Ship Date` — each with its own active relationship, so users get two slicers and every existing measure works against whichever they pick. The first keeps the model small and the measure list explicit; the second is far more discoverable for self-service users, at the cost of a duplicated table and two date slicers to explain.

code

dax · 9 lines
dax
-- active relationship: Date[Date] -> Sales[OrderDate]
Sales Ordered = SUM ( Sales[Amount] )

-- borrows the inactive relationship for this evaluation only
Sales Shipped =
CALCULATE (
    SUM ( Sales[Amount] ),
    USERELATIONSHIP ( 'Date'[Date], Sales[ShipDate] )
)

go deeper

for a junior

Be ready to say that only one relationship between two tables can be active, so the second date relationship is created inactive and shown as a dashed line in the model view.

for a middle

Explain both remedies and what each costs: USERELATIONSHIP inside CALCULATE for role-specific measures under one slicer, or a duplicated, clearly named date table so every measure follows the role the user picks.

for a senior

Show the judgment: pick per audience and per model size, watch for reports where a date slicer is silently filtering on the wrong role, and keep one governed calendar rather than letting automatic date hierarchies proliferate.

for a principal

Own the convention across models: which date roles are exposed, how they are named, and whether the organisation standardises on duplicated role tables so that reports built by different teams answer the same question the same way.

## What role-playing means here A dimension is *role-playing* when the same entity describes a fact in more than one capacity. A calendar date is the archetype: an order has an order date, a ship date, a due date and possibly a return date, all of which are dates from the same calendar. `Customer` does it too — a shipment has a sender and a recipient, both customers. Relational sources handle this with several foreign keys pointing at one dimension table. Power BI cannot, at least not directly, because of a rule in its relationship engine. ## The one-active-path rule Between any pair of tables, only **one** relationship path may be active at a time. Create the second relationship from `Date[Date]` to `Sales[ShipDate]` and Power BI creates it **inactive**: a dashed line in the model diagram, present but not participating in filter propagation. The rule exists so that a filter always has exactly one route to a table and therefore exactly one possible answer. The practical effect is that with an active relationship on `OrderDate`, *every* measure and *every* visual is filtered by order date. A slicer set to March shows sales **ordered** in March, whatever the report label says. That mislabelling — someone assuming the date slicer means ship date — is a routine source of "why is this number wrong". ## Approach one: one date table, role-specific measures Keep the single `Date` table with the active relationship on the most-used role, and write measures that borrow the inactive relationship: ```dax Sales Ordered = SUM ( Sales[Amount] ) Sales Shipped = CALCULATE ( SUM ( Sales[Amount] ), USERELATIONSHIP ( 'Date'[Date], Sales[ShipDate] ) ) ``` `USERELATIONSHIP` activates the named relationship for the duration of that `CALCULATE` only. Now a single date slicer drives both measures, and a table showing them side by side answers "what did we take in versus what did we get out of the door" in one visual — genuinely hard to build with two separate date tables. The costs: the behaviour is invisible on the model diagram, so a colleague sees a dashed line and no explanation; and every metric that needs the second role requires its own measure, which multiplies if you have four date roles and thirty measures. ## Approach two: duplicate the date table Load the calendar a second time under a clear name — `Order Date` and `Ship Date`, each with its own columns prefixed accordingly — and give each its own active relationship. Now the model is entirely self-describing: users drag `Ship Date[Month]` onto an axis and every measure follows without any special variant. This is the standard warehouse view of role-playing dimensions (typically implemented as views over one physical dimension) carried into Power BI. The costs: a duplicated table (small for a calendar, larger for `Customer`); two slicers that users can set inconsistently; and the awkwardness of comparing roles side by side, since each measure now follows whichever calendar it is grouped by. ## Choosing between them It is a genuine trade-off, and interviewers ask precisely because it has no single answer. Use duplicated tables when the report audience is self-service and needs to slice by each role independently — discoverability wins. Use `USERELATIONSHIP` when the roles must appear together in one visual under one slicer, when the measure count is small, or when the dimension is too large to duplicate comfortably. Many real models do both: a duplicated table for the primary alternative role, and `USERELATIONSHIP` measures for rarer ones. ## Related mechanics worth knowing Whichever route you take, the calendar table should be a real, contiguous date table and should be marked as a date table so time-intelligence calculations behave predictably. Power BI's automatic date/time feature also generates hidden per-column date tables in import models, which inflates model size and produces date hierarchies that do not match your calendar; most modellers turn it off and use an explicit calendar. And note the terminology trap: an *inactive relationship* is not a *deleted* one, and it is not the same as a relationship whose cross-filter direction is `None` for a measure — the first is activated with `USERELATIONSHIP`, the second is manipulated with `CROSSFILTER`. ## What interviewers listen for The answer must start from the one-active-path rule, then present both remedies with their costs. A weak answer proposes deleting one of the date columns, or claims Power BI simply cannot model two dates against one calendar.

  • What does USERELATIONSHIP actually do to the model while a measure evaluates?
    Inside the CALCULATE that names it, the inactive relationship becomes active and the previously active one between the same tables stands down, so filters propagate along the chosen path for that evaluation only. Nothing about the stored model changes, and every other measure and visual continues to use the original active relationship.
  • Why do many modellers disable Power BI's automatic date/time feature?
    Because in an import model it generates a hidden date table for every date column, inflating model size and offering hierarchies that do not match the organisation's fiscal calendar. A single explicit calendar table, marked as the date table and related to the fact columns you care about, is smaller, consistent and gives time-intelligence calculations a contiguous range to work with.
  • When is duplicating the dimension clearly better than USERELATIONSHIP?
    When self-service users build their own visuals. A separately named Ship Date table appears in the field list and every existing measure follows it automatically, whereas USERELATIONSHIP only works for measures someone wrote in advance. The trade is a duplicated table and two slicers that users can leave set inconsistently.

saying these in an interview costs you the question

  • Claims Power BI cannot relate one date table to two fact columns
  • Deletes one of the date columns to make the model load
  • Thinks an inactive relationship still filters visuals
  • Confuses activating an inactive relationship with changing cross-filter direction
  • Relies on the automatic date hierarchy instead of a real calendar table

context