Stop 06 · Data ModelingTopics · 5/9

Active vs Inactive Relationships

Part of the Power BI Roadmap

In short

Your Sales table has an Order Date and a Ship Date, and both should link to the Date table. Power BI allows only one of those links to be active at a time. The other waits for you to call it.

Only one relationship between two tables can be active. Extra ones, like Ship Date to the Date table when Order Date is active, are inactive and used through USERELATIONSHIP in DAX.

The jaadu stands at a switchboard with two plugs connected, one lamp glowing brightly while the jaadu reaches to flip the switch for the second, unlit lamp.

Think of it like this

Two plugs, one socket switch

Two appliances are plugged into a board, but only one switch is on. The other is connected and ready but gets no power until you flip it for a moment. An inactive relationship is that second plug, and USERELATIONSHIP flips its switch for one measure.

Watch it happen

Two links to the Date table

Active: OrderDate

  • Solid line in Model view
  • Used by every measure by default
  • Sales by month means by order month

Inactive: ShipDate

  • Dashed line in Model view
  • Ignored unless asked for
  • Turned on with USERELATIONSHIP

Keep the most common date active and use USERELATIONSHIP inside CALCULATE for the others.

The big ideas

What you need to know

Only one active path

Between two tables, only one relationship can be active, so filters never have two routes.

Dashed means inactive

In Model view an inactive relationship is drawn with a dashed line.

USERELATIONSHIP

Used as a CALCULATE argument to switch to the inactive relationship for that calculation only.

Ambiguous paths

Power BI also makes a relationship inactive if activating it would create two filter paths between tables.

See it in code

Walk through the code

dax
1Sales by Order Date =2SUM ( Sales[Amount] )3 4Sales by Ship Date =5CALCULATE (6    SUM ( Sales[Amount] ),7    USERELATIONSHIP ( Sales[ShipDate], 'Date'[Date] )8)

1/2Uses the active relationship on OrderDate, as every plain measure does.

Put both measures in a visual by 'Date'[Month]. Orders placed on 30 April but shipped on 2 May count in April for the first and May for the second.

Save yourself the pain

Common mistakes

Oops

Trying to make both date relationships active.

Do this instead

Only one can be active. Use USERELATIONSHIP in measures for the other date roles.

Oops

Using USERELATIONSHIP outside CALCULATE.

Do this instead

It's a CALCULATE modifier. It only works as a filter argument of CALCULATE or CALCULATETABLE.

Your mission

Order date vs ship date

~20 min

Quick check

What does USERELATIONSHIP do?

Go deeper

  1. 1Create both an order date and a ship date relationship to one Date table.
  2. 2Spot the dashed line that marks an inactive relationship.
  3. 3Come back to this in Phase 9 when you learn USERELATIONSHIP.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge