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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
cdcphist
Frequent Visitor

Dynamic Ranking with tiers

Hi,

 

I have the following example data:

IDcompanyvaluetier
1A1tier 1
3A5tier 3
4A2tier 2
8A3tier 2
7B2tier 2

 

Tier is a calculated column that has the following syntax:

 

tier = 
SWITCH (
TRUE (),
table[value] < max(table[value]) * 0.25, "tier 1",
table[value] < max(table[value]) * 0.50, "tier 2",
table[value] < max(table[value]) * 0.75, "tier 3",
"tier 4"
)

 

If i filter my data through slicers then not all rows of my data are being considered, meaning that instead of recalculating tiers for the filtered data, one or more of my tiers go missing. For example, if i use the slicers and choose only 2 companies:

 

IDcompanyvaluetier
1A1tier 1
3A5tier 3
4A2tier 2
8A3tier 2
7B2tier 2

 

I have no tier 4, because the max value is a company that is not selected. I've tried creating a secondary filtered table but i'm having trouble applying the filters through the slicers. How can i make this dynamic in order to always have all the tiers available?

 

Thanks.

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @cdcphist,

 

Sorry for delay reply.

I'm not sure your expected output.

Do you want to sort the value under each tier?

Please try calculated column as:

Rank_tier = 
var _tier='Table'[tier]
return
RANKX ( FILTER ( 'Table', 'Table'[tier] =_tier),'Table'[value] )

 

Best Regards,
Link

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xulin-mstf
Community Support
Community Support

Hi @cdcphist,

 

Sorry for delay reply.

I'm not sure your expected output.

Do you want to sort the value under each tier?

Please try calculated column as:

Rank_tier = 
var _tier='Table'[tier]
return
RANKX ( FILTER ( 'Table', 'Table'[tier] =_tier),'Table'[value] )

 

Best Regards,
Link

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

cdcphist
Frequent Visitor

Bump!

amitchandak
Super User
Super User

@cdcphist , Based on what I got, Try a measure like

 

tier =
var _max = maxX(all(Table), table[value])
SWITCH (
TRUE (),
table[value] < _max * 0.25, "tier 1",
table[value] < _max * 0.50, "tier 2",
table[value] < _max * 0.75, "tier 3",
"tier 4"
)

Hi @amitchandak ,

 

Thank you. I tried your suggestion but i get an error that a single value for "table[value]" cannot be determined.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.