Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Nikhil091
Regular Visitor

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?

Nikhil091_0-1717683110549.png

 

1 ACCEPTED SOLUTION
v-yaningy-msft
Community Support
Community Support

Hi, @Nikhil091 

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

vyaningymsft_1-1718011227092.png

vyaningymsft_2-1718011313897.png

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

View solution in original post

2 REPLIES 2
v-yaningy-msft
Community Support
Community Support

Hi, @Nikhil091 

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

vyaningymsft_1-1718011227092.png

vyaningymsft_2-1718011313897.png

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

qqqqqwwwweeerrr
Super User
Super User

Hi @Nikhil091 

 

You can check this video: https://youtu.be/cs2AwJljBrQ & https://youtu.be/O9Be1d_oi6Y here not exact but parameter are used to control top N.

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.