Forum Discussion

Bu__'s avatar
Bu__
Frequent Visitor
1 year ago
Solved

Filtering a table using TOP N slicer

Hi, i have a TOP N slicer which is a what if parameter from 0 to 50, i am trying to filter TOP N qty for a product in a table. please note there is already a TOPN filter on week for the table visua...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Bu__ ,

     

    Do you mean that you want to show TopN for each week? I think you can try ALLEXCEPT() function.

    rank = 
    VAR SelectedTop = SELECTEDVALUE('TOPN'[TOPN])
    RETURN
    SWITCH(TRUE(),
        SelectedTop = 0, [Still to supply_sum],
        RANKX(
            ALLEXCEPT('Table','Table'[Week]),
            [Still to supply_sum], ,DESC,Dense
            ) <= SelectedTop,
        [Still to supply_sum]
    )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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