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
fordmichael20
Frequent Visitor

Top N Within Matrix Table

Hey Power BI Community,

 

I have a question regarding potential augmentation and context-changing of Power BI Top N filter capabilities.

I have a matrix table right now that deals with positions of portfolios at a certain point in time, within the Matrix table I have the the following Rows:

Portfolio Name
Issuer [of the security] Name

I then have the market value of each issuer as a column.

What I'm trying to show Top 10 Issuers per portfolio by market value. When I select the Top N filter and change it to 10, this shows the top 10 issuers regardless of the portfolio. Is there a way to change this to have the top N refer to the first level of context in the matrix table?

1 ACCEPTED SOLUTION

Hi @fordmichael20,

 

Add a measure to your table with the following formula:

Rank_WITH_ALL =
RANKX (
    ALL ( Portfolio[Issuer] ),
    CALCULATE ( SUM ( Portfolio[Market Value] ) )
)

Then use this column in your matrix, if you need to hide it just reduce the size of the column

 

ranking.png

The second image is with the column reduced.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

7 REPLIES 7
MFelix
Super User
Super User

HI @fordmichael20,

 

Create a measure using RANKX and then use it as a visual filter and select the top 10.

 

Don't know how your data is setup but should be something like this:

Rank_Table =
RANKX (
    ALLSELECTED ( Table[Portfolio] ),
    CALCULATE ( SUM ( Table[Portfolio Amount] ) )
)

As I said don't know the format of the data but give it a try.

 

Regards,

Mfelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix

Thanks for the help,

 

I need to take this a bit further though. The data is set up as a table for an 'as at date'. This means when I apply the measure to the table, it evaluates every market value and assigns a rank to the entire table, I need to apply a rank in the hiearchy of Portfolio->Issuer

The data would look something like this 

PortfolioIssuerMarket Value
1A3000
1B400
1C500
1D8486
1E561
1F54053
1G65
1H65
1I565
1J84
1K651
1L3
1M123
1N22
2A635
2B6510
2Y561651
2Z560
ETCETCETC

 

And I would want my matrix table to show:

PortfolioIssuerMarket Value
1F54053
 D8486
 A3000
 K651
 I565
 E561
 C500
 B400
 M123
 J84
2Y561651
 B6510
 A635
 Z560
 ETCETC

Hi @fordmichael20,

 

Add a measure to your table with the following formula:

Rank_WITH_ALL =
RANKX (
    ALL ( Portfolio[Issuer] ),
    CALCULATE ( SUM ( Portfolio[Market Value] ) )
)

Then use this column in your matrix, if you need to hide it just reduce the size of the column

 

ranking.png

The second image is with the column reduced.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi! I am trying to do the same but adding a "Other" row in the matrix for those below to 21 (I am doing top 20) how can I do that?

where you able to do this? I am working on something similar group everything else in other category...

Hi @paulasanta ,

 

What are your needs?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hey,

 

This is great, thanks so much for your help.

 

Mike

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.