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

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

Reply
thaller
New Member

Dynamic ranking based on a matrix

Hi all,

 

I am rather new to PowerBI and I am trying to get a dynamic ranking. My current data is structured as follows:

Trade IDDateAsset ClassBrokerTrade amount
X0000110.01.2019CreditBARCLAYS     50 000 000.00
X0000220.06.2019CreditBARCLAYS     25 000 000.00
X0000320.01.2020CreditJPM     15 000 000.00
X0000420.01.2020CreditJPM     20 000 000.00
X0000530.03.2020MBSRBC     60 000 000.00
X0000619.12.2019MBSBNP   800 000 000.00
X0000721.02.2021MBSBARCLAYS        3 000 000.00
X0000804.03.2020MBSBNP     40 000 000.00
X0000910.01.2019CreditJPM     50 000 000.00
X00001020.06.2019MBSBARCLAYS     25 000 000.00
X00001120.01.2020CreditJPM     15 000 000.00
X0000721.02.2021MBSBNP        6 000 000.00

 

I would like to be able to rank each brokers within each asset class for each different year (e.g. BARCLAYS is best broker in 2019 for Credit). The criterion for ranking would be the sum of trade values (highest sum = highest ranking). As an intermediary result I think the matrix should look like the following:

 Credit MBS  
 20192020201920202021
BARCLAYS                  1                 2                 2
BNP                  1                              2                1
JPM                  2                              1   
RBC                                 1 

 

Utlimately I would like to display the results by single broker in the report as follows

Barclays201920202021
Credit100
MBS202

 

A contraint is that I need to keep these rankings dynamic as the user can:

- determine the time frame (e.g. ranking only on the time period 07/2019-06/2020)

- determine which broker to integrate 

Therefore I don't find it possible to implement a ranking by measures at the database level because it is then unaffected by the time slider.

 

Any help would be appreciated

Thank you

Thomas

1 REPLY 1
amitchandak
Super User
Super User

@thaller ,

 

rankx(allselected(Table[Broker]), calculate(Sum(Table[amount])))

 

rankx(filter(allselected(Table[Broker],table[Year]), [Year] =max([Year])), calculate(Sum(Table[amount])))

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.