Sub topic 4
Creating and Recognizing Inactive Relationships
This chapter assumes you can build a basic star schema in Power BI or an Analysis Services Tabular model. It also assumes you can write a simple DAX measure with SUM, and that you know what a one-to-many relationship is. You should also know that CALCULATE changes filter context. The previous chapters covered role-playing dimensions and the rule that only one relationship between two tables can be active. Here you create the extra relationships, learn how to spot them, and find out what they do and do not do until a measure turns them on.
What an inactive relationship is
An inactive relationship is a relationship that exists in the model but does not filter anything by default. The model stores its definition: the two columns, the cardinality, and the filter direction. The engine ignores it when it evaluates a query, unless a calculation explicitly activates it.
A model can hold many relationships between the same two tables. At most one of them can be active. The others must be inactive. In a typical sales model the setup looks like this:
| Relationship | Fact column | Date column | State |
|---|---|---|---|
| Order date | `Sales[OrderDate]` | `'Date'[Date]` | Active |
| Ship date | `Sales[ShipDate]` | `'Date'[Date]` | Inactive |
| Due date | `Sales[DueDate]` | `'Date'[Date]` | Inactive |
All three are many-to-one relationships from Sales to 'Date'. They differ only in the fact column and in the active flag.
An inactive relationship is not broken, and it is not an error. It is a stored option that a measure can use later with USERELATIONSHIP, which a later chapter covers in detail.
Why you end up with inactive relationships
You rarely decide to create an inactive relationship in the abstract. It appears because you tried to create a second relationship between two tables that already have an active one.
The rule from the previous chapter explains why. If two active paths connected Sales and 'Date', a filter on 'Date'[Year] would not have one clear meaning. It could mean orders placed in that year, or shipments made in that year. The engine refuses to guess. It allows only one active relationship, so one path always decides the filter.
When you add the second relationship through the model view, Power BI creates it as inactive for you. You do not have to make that choice yourself.
Creating an inactive relationship in Power BI Desktop
Start with a model where Sales[OrderDate] is already related to 'Date'[Date]. Both columns must have the same data type. Use the Date type on both sides, or the same whole-number key on both sides.
- Open the model view.
- Drag
Sales[ShipDate]onto'Date'[Date]. Alternatively, choose Manage relationships, then New relationship. - In the dialog, check that the table and column on each side are the ones you want.
- Set the cardinality to Many to one (
*:1), withSaleson the many side. - Set the cross filter direction to Single, so that the
'Date'table filtersSales. - Look at the Make this relationship active checkbox. Power BI clears it automatically, because an active relationship between these tables already exists.
- Select Save.
If you try to tick the box anyway, Power BI asks whether you want to deactivate the other relationship. Answer no. If you say yes, the order-date relationship becomes inactive and every existing visual and measure that relied on order date changes meaning without warning.
Repeat the same steps for Sales[DueDate].
Creating the relationship in a Tabular model
In Analysis Services or Azure Analysis Services, the same relationship is a property of the model definition. In the Tabular Object Model (TOM) JSON, an inactive relationship has isActive set to false. This sketch shows the shape:
{
"name": "Sales_ShipDate_Date",
"fromTable": "Sales",
"fromColumn": "ShipDate",
"toTable": "Date",
"toColumn": "Date",
"isActive": false
}In Visual Studio or Tabular Editor, you will find the same property in the relationship's property grid. The name is your choice, and you should choose a descriptive one. The generated GUID names that some tools assign are hard to read later.
Recognizing inactive relationships
Because an inactive relationship does nothing on its own, you need to be able to see which ones exist. There are several places to look.
In the model view
The diagram draws an active relationship as a solid line between the tables. An inactive relationship is a dashed line. In a role-playing setup you will see one solid line and one or more dashed lines between Sales and 'Date'. The small 1 and * markers show the cardinality on each end, and the arrow shows the filter direction.
In Manage relationships
The Manage relationships dialog lists every relationship in a table. The Active column has a checkbox for each row. This list is the quickest way to audit a larger model, because you can read every pair of columns on one screen.
In the Properties pane
Select a line in the model view and open the Properties pane. The Make this relationship active toggle shows its state. You can change the state here.
With DAX queries
You can also inspect relationships from a query. In DAX query view, DAX Studio, or SSMS, run this query:
EVALUATE
SELECTCOLUMNS (
INFO.RELATIONSHIPS (),
"Name", [Name],
"IsActive", [IsActive],
"FromTableID", [FromTableID],
"FromColumnID", [FromColumnID],
"ToTableID", [ToTableID],
"ToColumnID", [ToColumnID]
)INFO.RELATIONSHIPS is one of the INFO functions that expose model metadata. The columns return numeric IDs for tables and columns. To read them as names, join the result to INFO.TABLES() and INFO.COLUMNS(). Older tools expose the same data through the $SYSTEM.TMSCHEMA_RELATIONSHIPS dynamic management view, which you query with DMV syntax in SSMS or DAX Studio. Availability of the INFO functions depends on your version, so check your tool if the query fails.
What an inactive relationship does by default
Consider the base measure from the plan:
Sales Amount = SUM ( Sales[SalesAmount] )Suppose a matrix shows 'Date'[Year] on rows and [Sales Amount] as the value. The engine uses only the active relationship, so it filters Sales by Sales[OrderDate]. The ship-date and due-date relationships have no effect. A sale ordered on 28 December 2025 and shipped on 3 January 2026 appears under 2025.
This is the behavior to remember. Adding an inactive relationship does not change any existing report. That makes it safe to add, because no number moves until you write a measure that uses it.
The next diagram shows the model after you add the extra relationships.
Seeing the effect: the same query, three answers
The following measure shows the default behavior with a plain COUNTROWS. It counts fact rows for whichever date the active relationship uses.
Order Lines = COUNTROWS ( Sales )To see how the roles differ, compare it with measures that use the inactive relationships. These use USERELATIONSHIP, which later chapters explain in full. For now, read them only as a way to confirm that your inactive relationships exist and work.
Lines by Ship Date =
CALCULATE (
COUNTROWS ( Sales ),
USERELATIONSHIP ( Sales[ShipDate], 'Date'[Date] )
)
Lines by Due Date =
CALCULATE (
COUNTROWS ( Sales ),
USERELATIONSHIP ( Sales[DueDate], 'Date'[Date] )
)Put 'Date'[Year] and the three measures in one table visual. If the model is set up correctly, the values differ for any year that has orders shipped or due in a different year. Values that are identical in every row usually mean the dates in your data never cross a year boundary. Try the visual by month, where differences are more likely.
Validating the setup
After you create the relationships, check them before you build more measures on top.
- Confirm that exactly one relationship between the two tables is active. If none is active,
Sales Amountignores the Date table and every row shows the grand total. - Confirm that each relationship points from the many side (
Sales) to the one side ('Date'). The'Date'[Date]column must contain unique values. - Confirm that the data types match, and that no date has a time part. A
datetimevalue such as2026-01-03 14:30does not match the date2026-01-03in the Date table, so those rows come back blank. - Check that the Date table covers every date that appears in any of the fact columns. The Date table needs to span the earliest and latest date across all three columns, not only order dates.
- Mark the table as a date table so that time intelligence functions work, as a later chapter explains.
Common problems when creating relationships
| Symptom | Likely cause | What to do |
|---|---|---|
| The Make this relationship active box is cleared and cannot be ticked without a warning | Another relationship between the tables is already active | Leave it inactive and use `USERELATIONSHIP` |
| Existing visuals changed after you added a relationship | You accepted the prompt that deactivated the original relationship | Reopen Manage relationships and make the order-date relationship active again |
| A blank row appears in visuals, or ship-date measures show a blank category | Fact rows have a null or out-of-range date | Fix the data, or extend the Date table range |
| The relationship cannot be created because of duplicate values | `'Date'[Date]` has duplicates or a time part | Make the column unique at the day grain |
| Many-to-many cardinality is suggested | The Date column is not unique | Fix the Date table instead of accepting many-to-many |
Several of these problems also appear later in the pitfalls chapter. The checks above catch them at the point where you create the relationship, which is cheaper than finding them in a finished report.
Cardinality and filter direction for inactive relationships
An inactive relationship keeps its own cardinality and filter direction. When a measure activates it, the engine uses those settings as they were saved.
Keep the direction at Single, from 'Date' to Sales. A bidirectional filter on a date relationship is rarely needed, and it can create ambiguous paths when you have several of them. The engine can also refuse to create a relationship when it would make a path ambiguous. Power BI shows a message in that case.
A related restriction applies to the shape of the model. USERELATIONSHIP can activate only a relationship that already exists, and the two columns you name must be the ends of that relationship. You cannot use it to invent a join. If the pair of columns has no relationship, the function returns an error. A later chapter on pitfalls covers that error in more detail.
Row-level security and inactive relationships
One edge case deserves a mention. Row-level security (RLS) filters propagate through active relationships. If you define a security rule on the Date table, it filters Sales only through the active relationship by default. Security rules on the fact table's side are the safer design. Test with the View as feature before publishing, especially if your measures use inactive relationships.
Summary of the key points
- An inactive relationship is stored in the model but ignored in queries until a calculation activates it.
- You create one by adding a second relationship between two tables. Power BI marks it inactive automatically.
- Inactive relationships show as dashed lines in the model view and as unticked rows in Manage relationships.
- Adding one does not change existing results. A measure with
USERELATIONSHIPis what uses it. - Validate the data types, the Date table range, and the number of active relationships before you build on the model.
Exercise
A Sales table has OrderDate, ShipDate, and DueDate columns. Each is related to 'Date'[Date]. OrderDate is the active relationship. A colleague adds the ShipDate relationship, ticks Make this relationship active, and accepts the prompt that deactivates the other one. Existing reports now show different yearly totals. What happened, and how do you fix it?
Show answer
Accepting the prompt made the ShipDate relationship the active one and made the OrderDate relationship inactive. The unchanged measure Sales Amount = SUM ( Sales[SalesAmount] ) now filters by ship date, so yearly totals move for sales that cross a year boundary. To fix it, open Manage relationships, make the OrderDate relationship active again, which deactivates ShipDate, and use USERELATIONSHIP in a separate measure when ship-date results are needed.
Exercise
You open the model view and see between Sales and 'Date' one solid line and two dashed lines. What does each line type mean, and which one filters a plain SUM measure?
Show answer
The solid line is the active relationship and the dashed lines are inactive relationships. A plain measure such as SUM ( Sales[SalesAmount] ) is filtered only through the active relationship. The inactive ones have no effect until a measure activates them with USERELATIONSHIP inside CALCULATE.