Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Top n filter

  •  In this i have used RANKX function for Ranking and on ranking measure i used (is less than equal to 3)

  • But in Mi and Op i only want top 1 and else top 3 
  • I am not able to do that please help me .
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create measure.

    rank = RANKX(FILTER(ALL('Table'),'Table'[Week]=MAX('Table'[Week])),CALCULATE(SUM([OOS ROOS])),,DESC)
    Flag =
    IF(
    NOT( MAX('Table'[Week])) in {"MI","OP"} ,1,
    IF(
        MAX('Table'[Week]) in {"MI","OP"} &&[rank]=1,1,0))

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create measure.

    rank = RANKX(FILTER(ALL('Table'),'Table'[Week]=MAX('Table'[Week])),CALCULATE(SUM([OOS ROOS])),,DESC)
    Flag =
    IF(
    NOT( MAX('Table'[Week])) in {"MI","OP"} ,1,
    IF(
        MAX('Table'[Week]) in {"MI","OP"} &&[rank]=1,1,0))

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly