Sub topic 8
Alternative: Separate Date Tables for Each Role
This chapter covers the second way to handle a role-playing dimension: copy the Date table so each role gets its own table and its own active relationship. It assumes you know star schemas, one-to-many relationships, simple DAX measures, and the basics of CALCULATE and filter context.
The idea
So far, one 'Date' table has served two roles. Sales[OrderDate] has the active relationship, and Sales[ShipDate] has an inactive one that you switch on with USERELATIONSHIP. That works, but the choice of role lives inside each measure.
The alternative is to create a second Date table for the ship role. Each Date table then has its own active relationship to Sales. No relationship is inactive, so no measure needs USERELATIONSHIP.
Ship Date = 'Date'This calculated table copies every column and row of 'Date'. After you create it:
- Delete the inactive relationship between
Sales[ShipDate]and'Date'[Date], if you still have it. - Create a relationship from
Sales[ShipDate]to'Ship Date'[Date]. It is many-to-one, single direction, and active. - Mark
'Ship Date'as a date table if you plan to use time intelligence functions on it.
Using the two tables
Because both relationships are active, the base measure needs no change in logic. A slicer or visual axis decides which date role applies.
- Put
'Date'[Year]on an axis, and[Sales Amount]is grouped by order year. - Put
'Ship Date'[Year]on the same axis, and the same measure is grouped by ship year. - Put both on a matrix, with one on rows and one on columns, to compare when orders were placed with when they shipped.
That last case is the main advantage of this approach. With USERELATIONSHIP, a single measure uses only one role at a time. You cannot show order-date and ship-date filters crossed against each other with one measure. With two tables you can.
Filters from both tables combine. If a slicer selects 2025 on 'Date'[Year] and another selects December on 'Ship Date'[MonthName], Sales shows only rows that match both conditions. That is useful for questions such as "orders placed in 2025 that shipped in December".
Time intelligence on the copy
Time intelligence functions work on whichever date table you pass to them. A ship-date year-to-date measure does not need USERELATIONSHIP:
Shipped Sales YTD =
CALCULATE (
[Sales Amount],
DATESYTD ( 'Ship Date'[Date] )
)The filter lands on 'Ship Date', which reaches Sales through the active ShipDate relationship. Compare this with the version in the earlier chapter, which needed both USERELATIONSHIP and DATESYTD.
Costs of the approach
Duplicating the table has real costs.
| Concern | Effect |
|---|---|
| Model size | Each copy adds a table. For a Date table this is usually small, but it adds up with many roles. |
| Field list clutter | Users see `'Date'` and `'Ship Date'` with identical columns and must pick the right one. |
| Maintenance | Anything you add to `'Date'` after the copy, such as a new column or hierarchy, is a calculated column or formatting step you may need to repeat. A calculated table copies the columns that exist when it is evaluated, but measures, hierarchies, sort-by settings, and formatting on the original are not carried over. |
| Measure count | Measures are not duplicated, which is good. But each time-intelligence measure for a role must name the correct table. |
Name the copy clearly, and consider renaming its columns, for example Ship Year instead of Year, so visuals and field lists show which role they use. Renaming is done in the model view or the table editor, not in the DAX expression above.
When this approach fits
Choose separate tables when users need to slice by two roles at the same time, or when report authors build visuals directly from fields and should not need custom measures for each role. Choose USERELATIONSHIP when you want a smaller model and the role is fixed per measure.
Exercise
A report must show a matrix with order year on rows and ship year on columns, using the single measure [Sales Amount]. Why can USERELATIONSHIP alone not produce this, and what does the duplicated-table approach change?
Show answer
USERELATIONSHIP activates only one relationship per calculation, so a measure filters by one date role at a time. The Date table can therefore be tied to either OrderDate or ShipDate, but not both at once. With a copied 'Ship Date' table, each role has its own active relationship. Putting 'Date'[Year] on rows and 'Ship Date'[Year] on columns makes both filters apply together to the same [Sales Amount] measure.
Exercise
You create Ship Date = 'Date' and relate it to Sales[ShipDate], but the months in a ship-date visual sort alphabetically. What is the cause and the fix?
Show answer
The calculated table does not copy the sort-by-column setting from 'Date'. Set MonthName to sort by the month number column in 'Ship Date', and repeat any other hierarchy or formatting settings you need.