Forum Discussion
Date Slicer Modifying Employee List Based on Hire/Termination Date
- 2 years ago
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.
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.
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?