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
Enigma
Helper III
Helper III

Top N filter for each category

Hi, 

I have a simple table with two cols - Zone and Revenue. Zone values will always be either North, South, East or West.
I need to show the top 5 revenues for each of the four zones and filter out the rest of the rows. 

Something like this:
snap.png
How do I achieve this?

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Enigma , Create a new column

 

countx(filter(Table, [Zone] = earlier([zone]) && [revenue] <= earlier([revenue])),[revenue])

 

You can use this new column as filter <=5 in new table or measure

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Enigma , Create a new column

 

countx(filter(Table, [Zone] = earlier([zone]) && [revenue] <= earlier([revenue])),[revenue])

 

You can use this new column as filter <=5 in new table or measure

Hi @amitchandak 

 

I tweaked your suggestion a little bit and used the below : 

COUNTROWS(filter(Table1, Table1[Zone] = EARLIER(Table1[Zone]) && Table1[Revenue] <= EARLIER(Table1[Revenue])))

... and then in the table visual, I used the TOP N filter.

 

Thanks much for helping out. Never knew about the Earlier function before! 

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.