Relationships and alternate dates¶
Relationships are calculation infrastructure, not a diagram to fix after the formulas. The practice model uses unique dimension keys and single-direction dimension-to-fact filtering.
OrderDate and ShipDate answer different questions¶
DimDate's active relationship filters Sales[OrderDate]. The ShipDate relationship exists but is inactive until the measure requests it.
Revenue by Ship Date =
CALCULATE (
[Revenue],
USERELATIONSHIP ( DimDate[Date], Sales[ShipDate] )
)
USERELATIONSHIP activates the named existing relationship during that calculation; it does not create a relationship or permanently change the model. It supersedes a conflicting active relationship for that evaluation.
Run the shipping query:
| Period | Order-date Revenue | Ship-date Revenue |
|---|---|---|
| 2025-01 | 1100 | 1100 |
| 2025-02 | 2300 | 2100 |
| 2025-03 | BLANK | 200 |
| 2026-01 | 2400 | 2400 |
| 2026-02 | 3700 | 3300 |
| 2026-03 | BLANK | 400 |
Both unrestricted totals are 9500. Timing, not missing money, explains the monthly difference. Inspect SaleIDs 11 and 12 to account for the 400 in March.
Common relationship mistakes¶
- A date field stored as text cannot be assumed to match a Date key.
- Duplicate dimension keys invalidate the intended one-side cardinality.
- Orphan fact keys can produce an unknown/blank member.
- Bi-directional relationships may introduce ambiguity or unexpected paths.
- Many-to-many models need a deliberate grain/bridge design; they are not a generic remedy for duplicate keys.
RLS adds constraints to relationship behavior. Inactive relationships are not an automatic alternate RLS propagation path; USERELATIONSHIP can be restricted in affected security configurations. For production role-playing dates, consider separate active date dimensions and test the actual security model. This small unprotected Import exercise is not a universal secured model.
Exercise: predict the result before changing the date measure, then verify the inactive relationship still exists after the query. References: active/inactive relationship guidance and USERELATIONSHIP.