Sub topic 2
How an active relationship filters the fact table
This chapter explains the mechanism that every later chapter relies on. Before you can activate an inactive relationship, you need to know what an active one does. The chapter assumes you can build a star schema in Power BI or an Analysis Services Tabular model and write simple measures with SUM. It also assumes you know what a one-to-many relationship is and have seen filter context at a basic level.
The model used in this chapter
The examples use a small star schema. A Sales fact table has two date columns, OrderDate and ShipDate. A single 'Date' dimension table has one row per calendar day.
Two relationships connect the tables:
Sales[OrderDate]to'Date'[Date], many-to-one, single direction, active.Sales[ShipDate]to'Date'[Date], many-to-one, single direction, inactive.
This chapter only covers the active one. The inactive one is in the model, but it does nothing until a later chapter activates it.
The sample data is four rows:
| SalesOrder | OrderDate | ShipDate | SalesAmount |
|---|---|---|---|
| SO1 | 2026-01-15 | 2026-01-20 | 100 |
| SO2 | 2026-01-28 | 2026-02-03 | 200 |
| SO3 | 2026-02-10 | 2026-02-12 | 150 |
| SO4 | 2026-02-25 | 2026-03-02 | 50 |
The 'Date' table has columns such as Date, Year, MonthNumber, and MonthName. 'Date'[Date] is unique and has no gaps. The relationship is only valid because it is unique.
What "active" means
A relationship is a rule that says: when a filter lands on the table on the one side, pass it to matching rows on the many side. An active relationship is one the engine follows automatically. You do not mention it in a formula. Filtering 'Date' is enough to filter Sales.
Consider this measure:
Sales Amount = SUM ( Sales[SalesAmount] )The measure never names OrderDate, 'Date', or any relationship. Yet in a matrix with 'Date'[MonthName] on the rows, each month shows only the sales for that month. The reason is the active relationship.
Step by step: what happens for one cell
Take the matrix cell for January. The engine does the following:
- The row header creates a filter on the
'Date'table:'Date'[MonthName] = "January"(and the year, if it is in the visual). - The filter reduces
'Date'to the 31 rows for January. - The engine follows the active relationship from
'Date'[Date]toSales[OrderDate]. ASalesrow stays visible only if itsOrderDateequals one of the remaining dates. SUM ( Sales[SalesAmount] )runs over the visibleSalesrows only.
With the sample data, SO1 and SO2 have January order dates. The result is 100 + 200 = 300. February returns SO3 and SO4, which is 200.
Seeing it in a query
You can reproduce the matrix without a report by running a DAX query, for example in DAX query view in Power BI Desktop. The query defines the measure locally and groups it by month number and name:
DEFINE
MEASURE Sales[Sales Amount] = SUM ( Sales[SalesAmount] )
EVALUATE
SUMMARIZECOLUMNS (
'Date'[Year],
'Date'[MonthNumber],
'Date'[MonthName],
"Sales Amount", [Sales Amount]
)
ORDER BY 'Date'[Year], 'Date'[MonthNumber]With the sample data, the result is two rows: January 2026 with 300 and February 2026 with 200. March 2026 does not appear, because no Sales row has an order date in March. SUMMARIZECOLUMNS drops groups where every measure is blank. The SO4 sale shipped in March, but the model counts it by order date, so it belongs to February.
This is the property to remember: when a model has one active date relationship, "by date" always means that column. A report author who puts 'Date'[MonthName] on an axis gets order-date results. Nothing in the visual tells them which column drove it. That is why the choice of active relationship matters (a later chapter covers the choice).
Direction: the filter flows one way
The relationship has a cross-filter direction. For a normal one-to-many relationship, the direction is single. Filters flow from the one side ('Date') to the many side (Sales), and not the other way.
That has a consequence people trip over. If you filter Sales, 'Date' does not shrink. Suppose a slicer on Sales[SalesOrder] selects only SO1. A measure that counts date rows still sees every row:
Days In Model = COUNTROWS ( 'Date' )This returns the full row count of 'Date', not 1. The filter on Sales does not travel up to the dimension.
Single direction is the default recommendation, and the reasons are practical:
- Filter flow is predictable. A filter starts at a dimension and ends at a fact.
- Bidirectional filtering can create ambiguous paths when several relationships exist. This is exactly the situation role-playing dimensions create.
- Bidirectional filters add work for the engine, and can change totals in ways report users do not expect.
Active relationships also drive RELATED
Filter propagation is not the only thing an active relationship does. Row-level functions use the same relationship. RELATED reads a column from the one side while you are on a row of the many side, and it follows the active relationship:
Order Year = RELATED ( 'Date'[Year] )If you add this as a calculated column on Sales, each row gets the year of its OrderDate. If the model had only the inactive ShipDate relationship, RELATED could not follow it. In a model with both relationships, RELATED picks the active one. The measure and the column therefore agree on which date column they use.
What happens when a key has no match
The engine can only follow the relationship for keys that exist on the one side. Suppose a Sales row has an OrderDate that is not in 'Date', for example 2027-03-01 when the 'Date' table stops at 2026-12-31. The engine does not drop the row. It adds a blank member to the 'Date' table, a virtual row with blank values in every column, and assigns the orphan row to it.
In a report, this shows up as a row or column with a blank label, and its value is the total of the unmatched rows. The same happens when OrderDate is itself blank. A blank key matches the blank member.
You can detect orphans by comparing the grand total with the sum of the dated groups. A query that shows the blank group is a quick check:
DEFINE
MEASURE Sales[Sales Amount] = SUM ( Sales[SalesAmount] )
MEASURE Sales[Sales Rows] = COUNTROWS ( Sales )
EVALUATE
SUMMARIZECOLUMNS (
'Date'[Year],
"Sales Amount", [Sales Amount],
"Sales Rows", [Sales Rows]
)
ORDER BY 'Date'[Year]If a row appears with a blank Year, those Sales rows have no match in 'Date'. The fix is in the data. Extend the 'Date' table to cover the full range of every date column, or clean the bad keys at load time.
Why data types and time parts matter
A relationship matches by exact value. Two common causes of missed matches:
- A time portion. If
Sales[OrderDate]is a datetime such as2026-01-15 14:32:00, it does not equal the date2026-01-15 00:00:00in'Date'. Every row becomes an orphan. Convert the fact column to a date type, or build a separate date key, at load time. - Mismatched types. A text column cannot relate to a date column. Power BI refuses to create the relationship, or creates one that matches nothing. Make both columns the same type.
The ShipDate column adds a third case. An order that has not shipped has a blank ShipDate. Under an active relationship on ShipDate, those rows would land in the blank member. This is one reason OrderDate, which is always filled in, is a more natural choice for the active relationship.
Relationships and the grand total
The grand total of a measure is calculated with no filter on 'Date', so every Sales row is visible, including rows that matched no date. A matrix by month therefore adds up to the grand total only when no orphans exist. If the months sum to less than the total, look for a blank group or a month outside the visual's range.
The reverse is also true. A matrix filtered to 2026 sums to a smaller number than the grand total of a model that also holds 2025 data, because the year filter is part of the filter context. This is expected behavior, not a bug.
Checking which relationship is active
You can recognize the active relationship without running anything:
- In Model view in Power BI Desktop, an active relationship is a solid line. An inactive one is dashed.
- In the relationship properties dialog, the Make this relationship active box is checked for the active one.
- In Tabular Editor or TMDL, the relationship has
isActive: falsewhen inactive, and no such line when active, since active is the default.
A TMDL fragment for the two relationships in this chapter looks like this:
relationship SalesOrderDate
fromColumn: Sales.OrderDate
toColumn: 'Date'.Date
relationship SalesShipDate
isActive: false
fromColumn: Sales.ShipDate
toColumn: 'Date'.DateActive is the default, so the first relationship needs no property. The second sets isActive: false to mark it as inactive.
Summary of the working model
Keep these rules in mind when you read the next chapters:
- A filter on the dimension reaches the fact table only through a relationship the engine is allowed to use.
- Active relationships are used automatically, by measures and by
RELATED, with no change to the formula. - Filters flow from the one side to the many side. A filter on the fact table does not shrink the dimension.
- Fact rows with no matching key are kept and shown under a blank member, not dropped.
- "Sales by date" in the model means sales by the date column of the active relationship.
The last rule is the key one for this tutorial. The model has two date columns on Sales but one active relationship, so there is exactly one meaning of "by date". The next chapter explains why the model cannot have two active relationships between the same pair of tables.
Exercise
A matrix shows months from the 'Date' table on rows and [Sales Amount] = SUM ( Sales[SalesAmount] ) as the value. The active relationship is Sales[OrderDate] to 'Date'[Date]. Using the sample data in this chapter, what does the February row show? Then, a slicer on Sales[SalesOrder] selects only SO3. What does COUNTROWS ( 'Date' ) return in a card, and why?
Show answer
February shows 200, because SO3 (150) and SO4 (50) have February order dates. SO4 shipped in March, but the ship-date relationship is inactive, so it is not used. COUNTROWS ( 'Date' ) still returns the full number of rows in the Date table, not 1. The relationship has single cross-filter direction from Date to Sales, so a filter on Sales does not propagate back to Date.
Exercise
After a data refresh, the months in a report add up to 450, but the grand total of [Sales Amount] is 500. No filters are applied. What is the most likely cause, and how would you confirm it?
Show answer
Some Sales rows have an OrderDate with no match in 'Date', for example dates beyond the end of the Date table, a time portion in the datetime value, or blank keys. The engine assigns them to the blank member of 'Date', so they count in the grand total but in no month. Confirm it by grouping by 'Date'[Year] or 'Date'[Date] in a query or visual and looking for a blank group worth 50. Then extend the Date table or clean the keys.