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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
starry
Frequent Visitor

Ranking

Hi All

I am trying to create a bump chart, ranking the countries by Value over years. I have the following calculations:

 

Top N CountriesValues =

VAR TopSelected = SELECTEDVALUE('Top N'[Top N])

return

SWITCH(TRUE(),

TopSelected=0, [ONlyCountries Value],

RANKX(ALLSELECTED('Only Countries'[Country]), [ONlyCountries Value])<=TopSelected, [ONlyCountries Value])

 

 

RANK = RANKX(ALLSELECTED('Only Countries'[Country]),'Only Countries'[Top N CountriesValues])*-1

 

the reason why I need to calculate Top N CountriesValues is that I have a slicer Top N, which is showing how many countries I want to see in the chart based on their value.

For the bump chart I use Line chart, put Year on X-axis, RANK on Y-axis and Country on Legend.

The problem is when I select any value in the TOP N slicer, the bump chart is filtered ( showing selected N countries) BUT it is based on the laters year. for example I can see other countries during the years if they had the same rank as the TOP N selected countries. I think I am missing something in the RANK calculation...

 

starry_0-1675728442676.jpeg

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@starry , Try TOPN with numeric Parameters

 

Power BI Tutorial Series for Beginners Part 42 TOPN: https://youtu.be/QIVEFp-QiOk
TOPN with Numeric Parameter -https://youtu.be/cN8AO3_vmlY?t=26448

unfortunately this video doesn't help

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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