Forum Discussion
Multiple Date Fields
- 6 months ago
In a star schema you typically do not duplicate the Date table per date role unless you must. The best-practice approach is:
-
Keep one Date dimension (DimDate)
-
Create one active relationship (usually to CreatedOn)
-
Create additional relationships to the other date columns but keep them inactive
-
Use USERELATIONSHIP() (or calc groups) to activate the right date only inside the measures
Model setup:
-
DimDate[Date] (1) → Fact[CreatedOn] (*) Active
-
DimDate[Date] (1) → Fact[ResolvedDate] (*) Inactive
-
DimDate[Date] (1) → Fact[ValidationDate] (*) Inactive
This is the standard “role-playing date” pattern in Power BI.
Then role-based versions of measures:
Items Created = COUNTROWS(Fact) -- uses active CreatedOn relationship Items Resolved = CALCULATE( [Items], USERELATIONSHIP( Fact[ResolvedDate], DimDate[Date] ) ) Items Validated = CALCULATE( [Items], USERELATIONSHIP( Fact[ValidationDate], DimDate[Date] ) )Since you said “vast majority of measures are time intelligence based”, the maintenance pain is duplicating measures per date role. For this case you could simply use calculation groups and use than as filter on page/visual depending on your requirement. Example:
CALCULATE( SELECTEDMEASURE(), USERELATIONSHIP( Fact[ResolvedDate], DimDate[Date] ) ) -
Closed This Month =
CALCULATE(
COUNTROWS(FactTable),
USERELATIONSHIP(FactTable[Resolved Date], 'Date'[Date])
)
If this answer helped, please click 👍 or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande