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
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)

View solution in original post

6 REPLIES 6
v-yuaj-msft
Community Support
Community Support

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 @v-yuaj-msft 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)
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.

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

Google Drive Link 

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.