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
Lucas-128
New Member

Show only Top N rows

Hey everyone.

Im having trouble displaying the top (or bottom) N rows based in sales in my matrix visual.

I cant do any modifications on the model so the solution has to be frontend.

 

Example table: product, category and sales.

A product can have more than 1 category, therefore it has multiple entries. 

Lucas128_0-1661865543152.png

 

When I use Top N filter on product by sales, I end up with the following table.

Lucas128_1-1661865774301.png

The filter is working correctly but rather than seeing all the rows where any of the Top 2 appear,

I need to only see the 2 rows with the top (or bottom) sales.

 

Expected result: 

Lucas128_2-1661867026258.png

Any way to achieve this?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

It didnt work! I was able to resolve it by getting access to the model and creating another column 

Thanks anyways 🙂

 

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Lucas-128 , Create a measure

 

M1= calculate(Sum(Table[Value]) , allexcept(Table, Table[product]))

 

or

 

M2 = calculate(Sum(Table[Value]) , filter(allselected(Table) , Table[product] = max(Table[product])  ))

 

 

measure = sum(Table[Value])

use this in TOPN

 

CALCULATE( [Measure] ,TOPN(3,allselected('Table'[Product]), [M1] ,DESC),values('Table'[Product]))

It didnt work! I was able to resolve it by getting access to the model and creating another column 

Thanks anyways 🙂

 

 

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.