Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

How to Filter Top N with Field Parameters?

Hello Power BI Community,   I am using a native table and a field parameter and I want the table to be sorted based on top N when selecting a field parameter. I have tried doing this on Filter pane...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Sorry for being late! If the Past 5 GW points, Past 3 GW points, Total Points per player are currently all measures, it can still be achieved after my test:

    And the measure is like this:

    Measure 2 = 
    VAR _5 = RANK(DENSE, ALL('Table'), ORDERBY('Table'[_Past 5], DESC))
    VAR _3 = RANK(DENSE, ALL('Table'), ORDERBY('Table'[_Past 3], DESC))
    VAR _total = RANK(DENSE, ALL('Table'), ORDERBY('Table'[_Total], DESC))
    RETURN
    IF(
        MAX('Parameter 2'[Parameter]) = "_Past 5",
        IF(
            _5 <= 5,
            1,
            0
        ),
        IF(
            MAX('Parameter 2'[Parameter]) = "_Past 3",
            IF(
                _3 <= 3,
                1,
                0
            ),
            IF(
                MAX('Parameter 2'[Parameter]) = "_Total",
                IF(
                    _total <= 10,
                    1,
                    0
                ),
                1
            )
        )
    )

    The final output is as below:


     

    Note: It is on the Page2 in the pbix.


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