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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Ignore slicer of ranking column based on hierarchical data

Hi all,

I have created a matrix where I have multiple Values, including a ranking measure based on one of these values. I use 3 field names as my Rows, coming from a table with hierarchical data (Org -> Region -> Country ). My DAX expression for the Ranking measure is the following:

Rank = 
var _RankOrg = RANKX(ALLSELECTED('table'),[Rank Value],,DESC,Dense)
var _RankRegion = RANKX(ALLSELECTED('table'[Region],'table'[Org]),[Measure 1],,DESC,Dense)
var _RankCountry = RANKX(ALLSELECTED('table'[Country],'table'[Region],'table'[Org]),[Measure 1],,DESC,Dense)

RETURN
SWITCH (
    TRUE (),
    isinscope('table'[Country]) , _RankCountry,
    isinscope('table'[Region]) , _RankRegion,
    isinscope('table'[Org]) , _RankOrg,
    blank()
)

where [Measure 1] = is the measure based on that I want to define the ranking
and where [Rank Value] = 

CALCULATE( DIVIDE('Measures'[My Value],'Measures'[Total Market Value]),
ALLEXCEPT('table',table[Org]))

 

The ranking calculation works smoothly so far and as I drilldown in my matrix, I get the ranking figures per level (Org/Region/Country) properly.

My problem is that I want this ranking calculation to ignore the respective slicer I have (Org/Region/Country). So, when a user selects any of these values, the ranking figures should stay the fixed and they should not getting impacted by the selections of this slicer.

 

Any thoughts/ideas on this? Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please update the formula of measure [Rank] as below and check if it can get the expected result...

Rank =
VAR _RankOrg =
    RANKX ( ALL ( 'table' ), [Rank Value],, DESC, DENSE )
VAR _RankRegion =
    RANKX ( ALL ( 'table'[Region], 'table'[Org] ), [Measure 1],, DESC, DENSE )
VAR _RankCountry =
    RANKX (
        ALL ( 'table'[Country], 'table'[Region], 'table'[Org] ),
        [Measure 1],
        ,
        DESC,
        DENSE
    )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( 'table'[Country] ), _RankCountry,
        ISINSCOPE ( 'table'[Region] ), _RankRegion,
        ISINSCOPE ( 'table'[Org] ), _RankOrg,
        BLANK ()
    )

In addition, you can refer the following blog to try to solve the problem.

RANKX-apalooza: Within and Across Groups, With Filters, Etc. - P3 Adaptive

 

If the above ones can't help you figure out, please provide some source data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Please update the formula of measure [Rank] as below and check if it can get the expected result...

Rank =
VAR _RankOrg =
    RANKX ( ALL ( 'table' ), [Rank Value],, DESC, DENSE )
VAR _RankRegion =
    RANKX ( ALL ( 'table'[Region], 'table'[Org] ), [Measure 1],, DESC, DENSE )
VAR _RankCountry =
    RANKX (
        ALL ( 'table'[Country], 'table'[Region], 'table'[Org] ),
        [Measure 1],
        ,
        DESC,
        DENSE
    )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( 'table'[Country] ), _RankCountry,
        ISINSCOPE ( 'table'[Region] ), _RankRegion,
        ISINSCOPE ( 'table'[Org] ), _RankOrg,
        BLANK ()
    )

In addition, you can refer the following blog to try to solve the problem.

RANKX-apalooza: Within and Across Groups, With Filters, Etc. - P3 Adaptive

 

If the above ones can't help you figure out, please provide some source data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Anonymous
Not applicable

Hello, 

 

Has anyone any solution on my problem? Any ideas are much appreciated!

 

Thanks!

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!

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.