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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Young_G_Han
Helper III
Helper III

Rankx in the Matrix Hierarchy without no sales rows.

Hi.

 

I made a calculation for the rank displayed in a Matrix visualization with the formula below and it seems working.

 

Formula

Multi Rank =
if(
hasonevalue(Salesman[Salesman]),
RANKX(ALLSELECTED(Salesman[Salesman]),
CALCULATE([Sales], ALLSELECTED(Salesman[Region]))
),
if(
HASONEVALUE(Salesman[region]),
RANKX(ALLSELECTED(Salesman[Region]),
CALCULATE([Sales], ALLSELECTED(Salesman[Company Type]))
)
))

 

 

Matrix

Region     Salesman     Rank      Sales Amount

RegionA                          1           xxxxxx

                SalesmanA      1           xxxxxx

                SalesmanB      5           xxxxxx

RegionB                          2           xxxxxx

                SalesmanC      2           xxxxxx

                SalesmanD      6           xxxxxx

                SalesmanE      30          0

 

However, I need to delete the SalesmanE (Actually, I have many salesmen like E having no sales). So I made a filter for the Matrix, gave a condition as [Sales Amount] >0. When I apply the filter, the Matrix will show a different result as below.

All ranking of regions become '1' and the rank of salesman will be recalculated in each region.

 

Is there any way, I can keep the first result without the salesmen like the salesmanE?

Please help! 🙏

 

Matrix

Region     Salesman     Rank      Sales Amount

RegionA                          1           xxxxxx

                SalesmanA      1           xxxxxx

                SalesmanB      2           xxxxxx

RegionB                          1           xxxxxx

                SalesmanC      1           xxxxxx

                SalesmanD      2           xxxxxx

2 REPLIES 2
amitchandak
Super User
Super User

@Young_G_Han , best is that you use a visual level filter for sales > 0

 

or try like, where sales is measure

 

Multi Rank =
if(
hasonevalue(Salesman[Salesman]),
RANKX(ALLSELECTED(Salesman[Salesman]),
CALCULATE(sumx(filter(values(Salesman[Salesman]), [Sales] >0), [sales]), ALLSELECTED(Salesman[Region]))
),
if(
HASONEVALUE(Salesman[region]),
RANKX(ALLSELECTED(Salesman[Region]),
CALCULATE(sumx(filter(values(Salesman[Company Type]), [Sales] >0), [sales]), ALLSELECTED(Salesman[Company Type]))
)
))

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

Thank you for your advice.

I tried your formula, but the result is the same. I still have the 0 sales salesman in the Matrix.

😥

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors