Sub topic 1
One Date table, several roles: order, ship, and due dates
A sales fact table rarely has just one date. An order line has an order date, a ship date, and often a due date. All three describe a point in time, and all three are best analyzed against the same calendar. This chapter explains how one Date table can serve all of them, what a role-playing dimension is, and what that does to your relationships. Later chapters build on this to show how to switch between the roles in DAX.
Prerequisites
This chapter assumes you already know the following:
- Basic Power BI or Analysis Services Tabular modeling: tables, columns, and the Model view.
- Star schema terms: fact table, dimension table, and a one-to-many relationship.
- How to write a simple DAX measure such as
SUM. - A basic idea of CALCULATE and filter context. A filter context is the set of filters that decides which rows a measure sees.
You do not need to know USERELATIONSHIP yet. This chapter sets up the problem it solves.
The scenario: one fact table, three dates
Consider a Sales fact table with one row per order line. Here is a small sample:
| OrderID | OrderDate | ShipDate | DueDate | SalesAmount |
|---|---|---|---|---|
| 1001 | 2026-01-28 | 2026-02-03 | 2026-02-10 | 250 |
| 1002 | 2026-01-30 | 2026-01-31 | 2026-02-06 | 120 |
| 1003 | 2026-02-02 | 2026-02-09 | 2026-02-16 | 400 |
Each date answers a different business question:
- Order date: how much did customers order in January?
- Ship date: how much did we actually ship in January?
- Due date: how much is promised for delivery in the week of 9 February?
The same row lands in different months depending on the question. Order 1001 was ordered in January and shipped in February. If you report "January sales" without saying which date you mean, the number is ambiguous.
What a role-playing dimension is
A dimension is a table that describes the things you slice facts by, such as customers, products, or dates. A role-playing dimension is a single dimension table that the fact table references several times, once for each role the dimension plays.
The Date table is the classic example. It holds one row per calendar day, with columns such as Date, Year, Month, and Quarter. The fact table has three columns that each point at a row in it:
Sales[OrderDate]uses the Date table in the role "order date".Sales[ShipDate]uses it in the role "ship date".Sales[DueDate]uses it in the role "due date".
The calendar is the same in each case. Only the meaning of the link changes. This is why you do not build three separate calendars by default. One calendar is easier to maintain, and a single definition of "fiscal year" or "holiday" applies everywhere.
Other role-playing dimensions follow the same pattern:
- A flights table with
OriginandDestinationcolumns that both point at one Airport table. - A transfers table with
FromAccountandToAccountcolumns that both point at one Account table. - A project table with
ManagerandSponsorcolumns that both point at one Employee table.
The idea is the same each time: one dimension, several foreign keys, several roles.
How the model looks in practice
Suppose you load Sales and Date into Power BI. The Date table has a Date column with unique values and no gaps, and it is marked as the date table. You create three relationships, each from 'Date'[Date] (the one side) to a different Sales column (the many side):
| From (one side) | To (many side) | Typical state |
|---|---|---|
| `'Date'[Date]` | `Sales[OrderDate]` | Active |
| `'Date'[Date]` | `Sales[ShipDate]` | Inactive |
| `'Date'[Date]` | `Sales[DueDate]` | Inactive |
In Model view, an active relationship is drawn as a solid line and an inactive one as a dashed line. Only one of the three can be solid. The next sections explain why, and what "active" means for your reports.
What the active relationship does
A relationship carries filters from one table to another. With 'Date'[Date] related to Sales[OrderDate], filtering the Date table filters the Sales table. If a report visual has 'Date'[Month] on its axis, each month selects the Date rows for that month. Those rows then select the Sales rows whose OrderDate matches.
A simple measure shows the effect:
Sales Amount = SUM ( Sales[SalesAmount] )Place 'Date'[Month] on rows and [Sales Amount] as the value. The result is sales by order date, because the active relationship uses Sales[OrderDate]. The measure itself says nothing about dates. The model decides which date column is used.
With the sample data above, the January row shows 370 (orders 1001 and 1002), and February shows 400 (order 1003). Nothing in the formula tells you this is by order date. A reader looking at the report cannot tell either unless you name the measure or the visual clearly.
This matters for design. The active relationship is the default meaning of "date" for every measure in the model. Choose it deliberately. Most models make the order date active, because it is the date most business questions start from.
Why only one relationship can be active
You might ask why the model does not just keep all three relationships active. The reason is that filters need an unambiguous path.
If all three were active, a filter on 'Date'[Month] = "January" would have three possible meanings. Should it keep rows where the order date is in January, the ship date is in January, or the due date is in January? It could also mean all three at once, which would silently return only rows that satisfy every condition. None of these is a safe default, and the engine will not guess.
The rule is: between any two tables, only one relationship can be active at a time. This also covers indirect paths. The model must not contain two different active paths of filter propagation between the same pair of tables, because the engine would again have to choose between them.
What happens when you try to break the rule depends on the tool:
- In Power BI Desktop, when you create a second relationship between the same two tables, the new one is created as inactive.
- When you try to make an inactive relationship active while another is already active, you are asked to deactivate the first one, or the change is refused.
- When a model is loaded programmatically with conflicting active relationships, the model reports an ambiguous-path error.
So an inactive relationship is not a mistake. It is how the model records "this link is valid, but it is not the default".
Inactive relationships are still real
An inactive relationship stays in the model, with its columns and cardinality. It just does not propagate filters on its own. If you put 'Date'[Month] on rows and Sales[ShipDate] is linked through an inactive relationship, a normal measure ignores that link entirely.
You can recognize an inactive relationship in these ways:
- In Model view, it is shown as a dashed line.
- In the relationship's properties, the Make this relationship active box is cleared.
- In DAX, the
INFO.RELATIONSHIPS()function, or the$SYSTEM.TMSCHEMA_RELATIONSHIPSDMV in tools such as DAX Studio, lists each relationship with anIsActiveflag.
Because a normal measure ignores it, an inactive relationship can mislead people. A user may drag 'Date'[Month] next to a measure they expect to be "by ship date" and see order-date numbers. The model is working as designed. The relationship just needs to be activated for that calculation, and that is what the next chapters show.
Seeing the difference with numbers
Using the sample table, compare the two ways of grouping.
By order date (the active relationship):
| Month | Sales Amount |
|---|---|
| January | 370 |
| February | 400 |
By ship date (what a shipping manager wants):
| Month | Sales Amount |
|---|---|
| January | 120 |
| February | 650 |
The totals are equal at 770, but the months differ. Order 1001 (250) and order 1003 (400) are February shipments. Order 1002 (120) shipped in January. If the shipping manager looks at the first table, the report overstates January by 250.
The model can produce the second table, but not with the plain SUM measure. It needs a measure that switches to the ship-date relationship for one calculation. The preview below shows the shape of the answer. The following chapters explain every part.
Sales Amount by Ship Date =
CALCULATE (
[Sales Amount],
USERELATIONSHIP ( Sales[ShipDate], 'Date'[Date] )
)CALCULATE evaluates [Sales Amount] in a modified filter context. USERELATIONSHIP tells it to treat the inactive ship-date relationship as the active one for that evaluation only. The model's stored state does not change.
Design checklist for a role-playing Date table
Before relying on any of these relationships, check the following:
- Date column type. The fact columns and
'Date'[Date]should all be theDatetype, not date-time, unless the times are always midnight. A stray time value (for example2026-01-28 14:30) will not match the Date table and the row will show up under a blank date. - Coverage. The Date table should cover the earliest and latest dates in every role. Due dates often reach further into the future than order dates, so a calendar built only from order dates can leave later due dates unmatched.
- Unique, gap-free dates. The
Datecolumn must contain each date once. This is required for the one side of a one-to-many relationship. - Missing values. A fact row with no ship date yet (an order not shipped) has a blank in
ShipDate. Blank values do not match any Date row. Such rows are grouped under a blank member in visuals, and they never appear under a real date. This is normal, and later chapters return to it. - Marked as a date table. Marking the Date table (or setting up automatic time intelligence) lets DAX time functions work correctly.
- Which role is the default. Decide which relationship is active before writing any measures, because every measure silently depends on it.
Common misunderstandings
- "I need three Date tables." Not necessarily. Duplicated Date tables are one option, and a later chapter covers when they are the better choice. One shared table plus inactive relationships is the usual starting point.
- "The inactive relationship is broken." It is not. It is stored and ready, but filters do not flow across it until a calculation activates it.
- "Making a different relationship active fixes my ship-date report." It only moves the problem. Then all measures use the ship date, and the order-date report is wrong. The goal is to keep a sensible default and switch per calculation.
- "The Date table will filter by whichever date I put in the visual." The visual uses the Date table's own columns, such as
Month. The relationship decides which fact column those filter. The visual cannot choose.
Summary of the model state
At the end of the setup, the model should have these properties:
- One
'Date'table, with a uniqueDatecolumn. - Three relationships from
'Date'[Date]toSales[OrderDate],Sales[ShipDate], andSales[DueDate]. - Exactly one of them active, usually the order date.
- Plain measures such as
[Sales Amount]that follow the active relationship.
The remaining chapters take this model and show how to run a calculation along a different date.
Exercise
A Sales table has OrderDate, ShipDate, and DueDate, all related to one Date table. You create all three relationships in Power BI Desktop. Which date does a plain measure SUM ( Sales[SalesAmount] ) use when 'Date'[Month] is on the rows, and why are the other two relationships not used?
Show answer
It uses whichever relationship is active, normally the first one created, which is typically OrderDate. Only one relationship between two tables can be active, because otherwise a filter on the Date table would have several possible meanings. The other two relationships are inactive. They remain in the model but do not propagate filters unless a calculation, such as one using USERELATIONSHIP inside CALCULATE, activates them.
Exercise
Using the sample Sales table in this chapter, what would the January total be by ship date, and which order explains why it differs from the January total by order date?
Show answer
The January total by ship date is 120, from order 1002, which shipped on 2026-01-31. By order date, January is 370, because orders 1001 and 1002 were both ordered in January. Order 1001 was ordered in January but shipped on 2026-02-03, so it counts toward February by ship date.
Exercise
A fact row has a blank ShipDate because the order has not shipped. Where does it appear in a visual that groups by 'Date'[Month] through the ShipDate relationship, and does this mean the relationship is broken?
Show answer
The row has no matching Date row, so it appears under a blank member (or is not shown under any real month). The relationship is not broken. A blank foreign key cannot match any date. You can check for these rows separately if the business needs to know about unshipped orders.