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
DeeMC
Regular Visitor

Top N ranking across a number of rows - is it possible?

Hi, I'm hoping someone can help.  I have a dataset which has passengers by country split by nationality. It looks like this with dep country as the rows, nationality as the colums and passengers as the values.  I'm trying to use Top N to work out the Top 10 nationalities for each country but I can't seem to get it right.  When I try filtering by Top 10 on nationality using passengers as the value it just returns the Top 10 nationalities for the whole dataset.  Any ideas? Is it possible to create one table that shows the Top 10 nationalities ranked by passengers for each country? 

 

Image for query.PNG

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

Hi @DeeMC 

 

Firstly, please refer to https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523#M6071... while posting as it is easier for the reponders to sove.

 

Howver, I recreated this using a small sample to show top3.

 

topn.PNG

 

The PBIX is attached.

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

2 REPLIES 2
smpa01
Super User
Super User

Hi @DeeMC 

 

Firstly, please refer to https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523#M6071... while posting as it is easier for the reponders to sove.

 

Howver, I recreated this using a small sample to show top3.

 

topn.PNG

 

The PBIX is attached.

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
themistoklis
Community Champion
Community Champion

@DeeMC 

 

You cannot actually do that.

 

Just imagine that the matrix shows values across all nationalities and not for specific ones per row.

In other words if each country has a different list of top 10 nationalities then you will end up having way more columns than 10.

 

best way to get the result you want is to show both countries and nationalities as rows and finally show top 10 per country. It will be a straight table not matrix

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.

Top Solution Authors