Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Top N basis the filter value

I have a dataset which contains the Name and Joining Date and Salary of some employees. (Hypothetical Scenario, real scenario is different)   I have put the Name in the filter.   Now I have colum...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    I tried to create a sample pbix file like below.

    please check the below picture and the attached pbix file.

    I hope the below can provide some ideas on how to create a solution for your datamodel.

     

     

     

     

     

    Salary expected top10 measure: =
    VAR _slicerselect =
        MAX ( 'Employee slicer'[Employee] )
    VAR _slicerselectjoindate =
        CALCULATE ( MAX ( Employee[Join date] ), Employee[Employee] = _slicerselect )
    VAR _top10table =
        TOPN (
            10,
            FILTER ( ALL ( Employee ), Employee[Join date] <= _slicerselectjoindate ),
            Employee[Join date], DESC
        )
    RETURN
        CALCULATE ( SUM ( Employee[Salary] ), KEEPFILTERS ( _top10table ) )