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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
dstiefe
New Member

Show top n entries

How can i show the top 10 items by a measure (like sales) ?

10 REPLIES 10
Leiterfluid
Advocate I
Advocate I

Unfortunately, using either RANKX or TOPN are overcomplicated means to solve the problem.  IWs should not have to create new measures every time they want to scope or limit a result set to limited number.

 

RANKX has proven useless for me in a situation where I have over 200,000 rows in my dimension table against a 600,000 row fact table. Even a beefy Alienware laptop with 32 GB RAM could not process the measure.

 

This should be part of not just the standard table or chart functions (as it is in excel), but would be useful in Q&A scenarios where I could type in "Top 25 cities by gross revenue" to give me a scoped result set.

 


@Leiterfluid wrote:

... 

RANKX has proven useless for me in a situation where I have over 200,000 rows in my dimension table against a 600,000 row fact table. Even a beefy Alienware laptop with 32 GB RAM could not process the measure.

 

...

 


For a bit, I thought maybe it was just me. Misery loves company, though. Thanks!

RANKX surely work in "Import Data" mode, but power Bi Desktop prevents to use it in "Direct Query" mode, does anyone has solution for Direct Query

@Leiterfluid Please support the idea here if you want to see this feature.

Greg_Deckler
Community Champion
Community Champion

Use the RANK or RANKX function as specified here based on your sales number:

https://msdn.microsoft.com/en-us/library/gg492169.aspx

Then in your pivot table/Power View table put a filter on that Rank is <= 10.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hello Greg, 

 

Is there a way to do this without programmation?

 

Using an option in Power BI? 

 

Looks complicated... don't even know where to put the formula!

 

Cheers & thanks for your answer, 

Edouard

How do i display rank  number if measure value as Zero "0" .

SamLester
Microsoft Employee
Microsoft Employee

Quick update: Top N filters were just added in the October 2016 release.

 

https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-october-feature-summary/#analytics

 

Thanks,
Sam Lester (MSFT)

When I use the above RANKX solution on Desktop and put it in a column chart, it works fine until I add a legend. The filter on ranking goes away.  Any idea if Desktop will have some built-in Top N functionality ike Pivot tables do?

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.