Forum Discussion
luxpbi
Helper V
7 years agoTime Intelligence with 2 calendars
Hi! This is my scenario: I have 1 fact table [Fact] with 2 dates and 2 calendars, [CalendarA] and [CalendarB]. I have both calendars with active relationships with the facts table. One dat...
- 7 years ago
Hi luxpbi
You may use USERELATIONSHIP Function.Please check attached file.
Reference:https://www.sqlbi.com/articles/userelationship-in-calculated-columns/
Measure B = CALCULATE( DISTINCTCOUNT( TableA[Booking number]),USERELATIONSHIP(CalendarA[DateA],TableA[DateB]))Measure B LY = CALCULATE( [Measure B], SAMEPERIODLASTYEAR( CalendarA[DateA].[Date]))Regards,
luxpbi
Helper V
7 years agoHi v-cherch-msft ,
It works as expected, but I need the next scenario:
If I filter year everything works fine:
but if I filter Month I need to see all future dates for Measure B.
Hope you can help in this scenario.
Thank you a lot !! for your help :)
Yggdrasill
Responsive Resident
7 years agoOne Calendar with multiple relationships where one is active and other inactive should work alongside with the DAX function USERELATIONSHIP() -
e.g.
Revenue by check-out date =
CALCULATE([Amount],
USERELATIONSHIP('date'[date],
'factTable'[check-out date])
)where
Amount = SUM('factTable'[Amount])
and your calendar has active relationship between 'factTable'[check-in date] and 'date'[date] and INACTIVE relationship between 'factTable'[check-out date] and 'date'[date]