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
RevOps608
Helper II
Helper II

Using RANK and SWITCH together

My SWITCH statement works properly but I need to RANK the results within a Heirarchy. I have Territory_Managers and then Salespeople grouped below them. How do I rank each group of salespeople within their territory.

 

Quota SWITCH =
SWITCH(
    TRUE(),
    [Quota Selection] = "January Quota", FORMAT(DIVIDE([2024 Sales PGACV], [January quota]),"0.0%"),
    [Quota Selection] = "February Quota", FORMAT(DIVIDE([2024 Sales PGACV], [February Quota]),"0.0%"),
    [Quota Selection] = "March Quota", FORMAT(DIVIDE([2024 Sales PGACV], [March Quota]),"0.0%"),
    [Quota Selection] = "April Quota", FORMAT(DIVIDE([2024 Sales PGACV], [April Quota]),"0.0%"),
    [Quota Selection] = "May Quota", FORMAT(DIVIDE([2024 Sales PGACV], [May Quota]),"0.0%"),
    [Quota Selection] = "June Quota", FORMAT(DIVIDE([2024 Sales PGACV], [June Quota]),"0.0%"),
    [Quota Selection] = "Q1 Quota",FORMAT( DIVIDE([2024 Sales PGACV], [Q1 Quota]),"0.0%"),
    [Quota Selection] = "Q2 Quota", FORMAT(DIVIDE([2024 Sales PGACV], [Q2 Quota]),"0.0%"),
    [Quota Selection] = "H1 Quota", FORMAT(DIVIDE([2024 Sales PGACV], [H1_Quota]),"0.0%"),
    [Blank]
)
 
RANK.png
1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@RevOps608 

 

output : 

Daniel29195_0-1706656024771.png

 

ranking = 
var datasource = 
CALCULATETABLE(
    SUMMARIZE(
        table_1,
        table_1[territorymanager],
        table_1[salespeople]
    ),
    REMOVEFILTERS(table_1[salespeople])
)
var r =
RANK(
    ,
    datasource,
    ORDERBY([total sales] , desc ) 
)
return r

 

 

 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

View solution in original post

3 REPLIES 3
Daniel29195
Super User
Super User

@RevOps608 

 

output : 

Daniel29195_0-1706656024771.png

 

ranking = 
var datasource = 
CALCULATETABLE(
    SUMMARIZE(
        table_1,
        table_1[territorymanager],
        table_1[salespeople]
    ),
    REMOVEFILTERS(table_1[salespeople])
)
var r =
RANK(
    ,
    datasource,
    ORDERBY([total sales] , desc ) 
)
return r

 

 

 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

It was my FORMAT that was making the difference. Unsure why my % via FORMAT was different then just marking the SWITCH as a %. Maybe it was a text string? 

 

Thanks

@Daniel29195 

thank you! It's working....mostly. It works fine for anything < 100%. Any idea why anything over would throw it off and do you have a solution?

 

rank_.png

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