Forum Discussion

cocohoney's avatar
cocohoney
Frequent Visitor
2 years ago
Solved

Use a date slicer to dynamically filter last know value for a given listing

Hi,   I am currently struggling trying to set up a HR positions listing.   My entry data is the HR listing displaying for each employee, all their positions held and for each position held their ...
  • lbendlin's avatar
    2 years ago
    But what I am actually trying to do is to incorporate a date slicer 

    That 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..

  • Anonymous's avatar
    Anonymous
    2 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.