Forum Discussion
Create two date field relationship with date table for slicer
I have already had a "Date completed" relationship with Date table. What if I have another measure with "Date commenced" which also want to use the slicer to show dynamic figure. Is it possible? What shoud I do? Thanks
5 Replies
- _AAndrade
Resident Rockstar
Hi rachelbi,
You can create another relationship between Date Table and Assessments Table and put on inactive and then use the Function USERELATIONSHIP to activate that relationship for that specific measure.
Take a look at this article: https://www.sqlbi.com/articles/using-userelationship-in-dax/ - rachelbi
Helper I
Thanks _AAndrade for your reply. I tried but don't know where to put the USERRELATIONSHIP() function.
.....
RETURNCALCULATE(DISTINCTCOUNT( Assessments[Assessment Title] ),FILTER(Assessments,Assessments[Site Name.lookupId] IN SelectedSites),DATESBETWEEN(Assessments[Date Commenced],'Measure'[Start Date],'Measure'[EndDate]))- _AAndrade
Resident Rockstar
Why you are using the assessments Date Commenced as a date table on DATESBETWEEN formula? You should use your date table.
The USERELATIONSHIP formula would be added on the filter of calculate function, but I didn't understand why you are using DATESBETWEEN formula.- rachelbi
Helper I
I have made the inactive relationship and below change but still showing blank ...
...
RETURNCALCULATE(DISTINCTCOUNT( Assessments[Assessment Title] ),FILTER(Assessments,Assessments[Site Name.lookupId] IN SelectedSites),USERELATIONSHIP(Assessments[Date Commenced],'Date'[Date]))