Forum Discussion

Nikhil091's avatar
Nikhil091
Regular Visitor
2 years ago
Solved

Can I use Numeric range parameter as a filter for TOP N filtering on a visual?

I want to link my Left visual that shows number of departures from each station with the numeric parameter on the right?
Like if the user wants to see top 5 station they can type 5 and just see them, or type 3/10/20 whatever is the max limit (I defined it as 50)
but not sure how to do that?

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Nikhil091 

    Thanks for qqqqqwwwweeerrr reply. If it does not work, you can refer to the following DAX.



    DAX:

    Categorys = 
    CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Category]))
    RANK = 
    VAR _rank = RANKX('Table',CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Category])),,DESC,Dense)
    VAR _trueRank = DIVIDE(_rank,'Table'[Categorys])
    RETURN
    _trueRank
    Flag = 
    VAR _para =
        SELECTEDVALUE ( Parameter[Parameter] )
    VAR _re =
        IF ( SUM('Table'[RANK]) <= _para, 1, 0 )
    RETURN
        _re
    

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

2 Replies