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
dstiefe
New Member

Show top n entries

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

10 REPLIES 10
Leiterfluid
New Member

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
Super User
Super User

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.


@ 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!:
The Definitive Guide to Power Query (M)

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" .

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
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.