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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
kulpowerbi
Helper I
Helper I

Rank for Hierarchy in Matrix visual not working

I am looking for solultion that find ranking even when we have Hirarchy. But on my method ranking is only working for one category in matrix, rest are showing rank as one onlye. Attached please see the screenshot and mesure details. 

kulpowerbi_0-1612157929229.png

Measures:

%To GoalRank_Ofc = RANKX(ALLSELECTED(Clinics[Office]),[%To Goal],,DESC,Dense)
%To GoalRank_Rgn = RANKX(ALLSELECTED(Clinics[Region]),[%To Goal],,DESC,Dense)
%To GoalRank_Cnt_Rgn = IF(ISINSCOPE(Clinics[Office]),[%To GoalRank_Ofc],[%To GoalRank_Rgn])
'
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@kulpowerbi , Thanks for sharing the file. Please try a formula like

%To GoalRank_Ofc = RANKX(FILTER(ALLSELECTED(Clinics[Office],Clinics[Region]),Clinics[Region] =max(Clinics[Region])),[%To Goal],,DESC,Dense)
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

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @kulpowerbi ,

 

Based on your description, you can create a measure as follows.

Measure =

var x1=RANKX(ALL('Table'[Region]),CALCULATE(SUM('Table'[%-Goal])),,DESC)

var x2=RANKX(FILTER(ALL('Table'[Office],'Table'[Region]),[Region]=MAX('Table'[Region])),CALCULATE(SUM('Table'[%-Goal])),,DESC)

return

IF(HASONEVALUE('Table'[%-Goal]),x2,x1)

 

Result:

v-yuaj-msft_0-1612317046341.png

 

v-yuaj-msft_1-1612317046342.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you @Anonymous for posting the solution, I will try out this way and revert back. 

amitchandak
Super User
Super User

@kulpowerbi , Thanks for sharing the file. Please try a formula like

%To GoalRank_Ofc = RANKX(FILTER(ALLSELECTED(Clinics[Office],Clinics[Region]),Clinics[Region] =max(Clinics[Region])),[%To Goal],,DESC,Dense)
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
kulpowerbi
Helper I
Helper I

@amitchandak  In the sample file it's working fine for me too. I have also tried Page level filter and visual level filter on and still on sample file everything is good. 

ON my actual table: I have some Infinty and NAN values, which I am hiding by page level filter, plz see the screenshot:

kulpowerbi_0-1612201729702.png

 

RegionOffice%-Goal
NorthHUD263.10%
NorthLOL105.37%
NorthNPR310.29%
NorthSH160.24%
NorthTARPON204.52%
SouthTPA281.35%
SouthSTPETE259.57%
SouthSEM237.42%
SouthPC84.02%
SouthVALRICO78.37%
Westaa10.00%
Westbb15.00%
amitchandak
Super User
Super User

@kulpowerbi , at first look measure seems correct.

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

@amitchandak  Here is the sample file attached in google drive link:

Google Drive Link 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors