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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
123abc
Community Champion
Community Champion

RANKX for Main Category then for furthermore 4 sub-category

Dear Respected Sirs & Experts,

I need Rankx for mian category then for furhtermore 4 sub category (Rank for 2 Region then 7 Zone then 24 Branches and then 45 Area Sales Offiers) , please guide how to do this ?

 

Reference data is attached.

https://drive.google.com/file/d/18ULxB7JdQXjqQszXQHw9BQ28lazJsD5X/view?usp=sharing

@Ashish_Mathur  @amitchandak  

Thank You so much for support.

 

Desire Result Page 1Desire Result Page 1Desire Result Page 2Desire Result Page 2

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Based on what you shared, one of ways to create a measure is like below.

 

ISINSCOPE function (DAX) - DAX | Microsoft Learn

RANK function (DAX) - DAX | Microsoft Learn

 

Rank =
SWITCH (
    TRUE (),
    ISINSCOPE ( ASO[ASO Name] ),
        RANK (
            SKIP,
            ALL ( ASO[ASO Name], ASO[Branch], ASO[Zone], ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        ),
    ISINSCOPE ( ASO[Branch] ),
        RANK (
            SKIP,
            ALL ( ASO[Branch], ASO[Zone], ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        ),
    ISINSCOPE ( ASO[Zone] ),
        RANK (
            SKIP,
            ALL ( ASO[Zone], ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        ),
    ISINSCOPE ( ASO[Region] ),
        RANK (
            SKIP,
            ALL ( ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

Excellent Its work in a great manner. Thank You So much Sir Jihwan_Kim. Jazak Allah Kher.

 

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

Based on what you shared, one of ways to create a measure is like below.

 

ISINSCOPE function (DAX) - DAX | Microsoft Learn

RANK function (DAX) - DAX | Microsoft Learn

 

Rank =
SWITCH (
    TRUE (),
    ISINSCOPE ( ASO[ASO Name] ),
        RANK (
            SKIP,
            ALL ( ASO[ASO Name], ASO[Branch], ASO[Zone], ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        ),
    ISINSCOPE ( ASO[Branch] ),
        RANK (
            SKIP,
            ALL ( ASO[Branch], ASO[Zone], ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        ),
    ISINSCOPE ( ASO[Zone] ),
        RANK (
            SKIP,
            ALL ( ASO[Zone], ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        ),
    ISINSCOPE ( ASO[Region] ),
        RANK (
            SKIP,
            ALL ( ASO[Region] ),
            ORDERBY ( CALCULATE ( SUM ( ASO[Sales Ach] ) ), DESC )
        )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi Jihwan_Kim,

Thank for first solution, when i used this solution as discussed before its working excellent but when i used this DAX measure with New parameter command in Modeling Tab by filtered Region, Zone, Branhes and Area Sales Offier seperattarly (Pic attached) then Dax measure missed some rankings in Area sales officer and branches but region and zone is OK, i try to fix it but i no idea why this happen.

 

Region and Zone Ranking is OKRegion and Zone Ranking is OKNo 3 rank is missing and Rank 1 is not calculated in Branch level rankingNo 3 rank is missing and Rank 1 is not calculated in Branch level rankingASO level 4 ranking is missing and start ranking from rank no 4ASO level 4 ranking is missing and start ranking from rank no 4

Excellent Its work in a great manner. Thank You So much Sir Jihwan_Kim. Jazak Allah Kher.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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