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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.