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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Top/Bottom N Rows based on selected filter values

Hoping for someone to point me in the correct direction. I seem to be going in circles with my code.

 

I'm needing to filter countries in a table visual based on selections in a filter (currently works). Then I need to display the Top 10/Bottom 10 within those filtered countries (mostly works). The only issues I'm hitting is when there is less than 10 to display. At that point, I'm getting a display of all the countries, rather than a limited list. 

3 REPLIES 3
AlB
Super User
Super User

@Anonymous

 

Can you show your code or share the pbix file so that people can try to see what the issue is? It's kinda hard with the info provided.

Anonymous
Not applicable

@AlB

 

Don't think I can share the .pbix because of the contract's privacy agreements, but I can share some snippets of code. I anonymized some stuff.

 

Ranking the countries:

CountryRank = RANKX('Company_Lookup','Company_Lookup'[Country_Final])

 Calculating the total number of times a metric has met or exceeded the selected benchmark:

Hit_rate = 
VAR result =
    CALCULATE (
        'A_Raw'[A_TargetYN] + 'B_Raw'[B_TargetYN]
            + C_Raw'[C_TargetYN]
            + 'D_Raw [D_TargetYN]
            + 'E_Raw'[E_TargetYN]
            + 'F_Raw'[F_TargetYN]
    )
RETURN
    result

 

Measure we're using currently to generate a rank for the top 10/bottom 10:

HitRank = calculate(1000*[Hit_rate] + MAX(Company_Lookup[CountryRank]))

I'm using the TopN feature in the Table visualization, based on HitRank.

Hi @Anonymous

 

It seems you may try to use ALLSELECTED Funtion to create rank measure. Here is the post for your reference. If it is not your case, please share some simplified sample data for your scenario so that we could help further on it. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.

How to Get Your Question Answered Quickly

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.