Forum Discussion
Date Slicer Modifying Employee List Based on Hire/Termination Date
Looking for some guidance on how to make employee names appear or disappear based on the date slicer chosen. In other words, can the date slicer change the employee slicer to who was "employed" during that time period. Would appreciate anyone's help on this. I have the hire dates, termination dates and have that linked to my date table already.
That's a standard "measure as visual filter" pattern. Create a measure that returns 1 for a given employee and date if the date falls between hire and termination, and 0 otherwise. Then in the visual where you list the employees set the visual filter to the measure being equal to 1.
- Anonymous2 years ago
Hi Scientist324
Thank you very much lbendlin for your prompt reply. Allow me to add some details.
“Employee”
Create a measure. Determine if the employee is employed within the scope of the slicer.
Measure = var _mindate = MIN('Date'[Date]) var _maxdate = MAX('Date'[Date]) var _hiredate = SELECTEDVALUE('Employee'[hire dates]) var _terminationdate = SELECTEDVALUE('Employee'[termination dates]) RETURN IF( (_hiredate >= _mindate && _hiredate <= _maxdate) && (_terminationdate <= _maxdate && NOT(ISBLANK(_terminationdate))) , 1, 0 )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- lbendlin
Super User
That's a standard "measure as visual filter" pattern. Create a measure that returns 1 for a given employee and date if the date falls between hire and termination, and 0 otherwise. Then in the visual where you list the employees set the visual filter to the measure being equal to 1.
- Scientist324Regular VisitorTried this measure and I am getting an error from using two different tables.
IF(('Employee Table'[Hire Date])<(MIN('Calendar'[Date])&&('Employee Table'[Terminate Date])>(MAX('Calendar'[Date]),"1","0")))
- AnonymousNot applicable
Hi Scientist324
Thank you very much lbendlin for your prompt reply. Allow me to add some details.
“Employee”
Create a measure. Determine if the employee is employed within the scope of the slicer.
Measure = var _mindate = MIN('Date'[Date]) var _maxdate = MAX('Date'[Date]) var _hiredate = SELECTEDVALUE('Employee'[hire dates]) var _terminationdate = SELECTEDVALUE('Employee'[termination dates]) RETURN IF( (_hiredate >= _mindate && _hiredate <= _maxdate) && (_terminationdate <= _maxdate && NOT(ISBLANK(_terminationdate))) , 1, 0 )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Scientist324Regular Visitor
This measure does not produce an error but it does not the msaure from 0 to 1 when I change the date slider (or visa versa) Any thoughts?