Forum Discussion
Use a date slicer to dynamically filter last know value for a given listing
- 2 years ago
But what I am actually trying to do is to incorporate a date slicerThat slicer must be fed from a disconnected table and then you need to use a measure to read the slicer value and to compute the status for each employee..
- Anonymous2 years ago
Hi cocohoney ,
I create a table as you mentioned and I also create a Date table.
Date = CALENDAR(MIN('Table'[STARTING DATE POSITION]),MAX('Table'[ENDING DATE POSITION]))Then I create a calculated column and here is the dax code.
LastPositionDate = VAR currentID = 'Table'[EmployeeID] VAR selectedDate = MAX ( 'Date'[Date] ) RETURN CALCULATE ( LASTDATE ( 'Table'[STARTING DATE POSITION] ), FILTER ( ALL ( 'Table' ), 'Table'[EmployeeID] = currentID && 'Table'[STARTING DATE POSITION] <= selectedDate ) )Next I create a new table.
HRListingLastPosition = FILTER( 'Table', 'Table'[STARTING DATE POSITION] = 'Table'[LastPositionDate] )Finally you will get what you want.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi cocohoney ,
I create a table as you mentioned and I also create a Date table.
Date = CALENDAR(MIN('Table'[STARTING DATE POSITION]),MAX('Table'[ENDING DATE POSITION]))
Then I create a calculated column and here is the dax code.
LastPositionDate =
VAR currentID = 'Table'[EmployeeID]
VAR selectedDate =
MAX ( 'Date'[Date] )
RETURN
CALCULATE (
LASTDATE ( 'Table'[STARTING DATE POSITION] ),
FILTER (
ALL ( 'Table' ),
'Table'[EmployeeID] = currentID
&& 'Table'[STARTING DATE POSITION] <= selectedDate
)
)
Next I create a new table.
HRListingLastPosition =
FILTER(
'Table',
'Table'[STARTING DATE POSITION] = 'Table'[LastPositionDate]
)
Finally you will get what you want.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much for your help. I had posted my problem twice as my posts were flagged as spams and you gave me a different implementation so thank you for that.