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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Alistar45
Regular Visitor

Make ranking according to sales percentage

Hi there,

 

I have quite a situation. I'd like to make a ranking (or clustering) according to the sales percentage of several stores. Is this possible? I already know how to make a ranking in regards to sales amount but i'd like to get a clustering from it. How would i go about it?

 

Let me show you an example:

 

CHAINSTORESELL OUTRANKSALES SHARENEW RANK
CHAIN TSTORE I$35,975.84130%S
CHAIN TSTORE D$19,160.24216%A
CHAIN TSTORE E$16,220.86313%A
CHAIN TSTORE B$14,516.19412%A
CHAIN TSTORE H$13,962.34512%A
CHAIN TSTORE A$8,421.5867%B
CHAIN TSTORE L$6,244.8475%B
CHAIN TSTORE F$2,397.5282%C
CHAIN TSTORE C$1,779.7891%C
CHAIN TSTORE G$1,449.52101%C
CHAIN TSTORE J$881.72111%C
CHAIN TSTORE K$388.97120%C

 

I have everything until the Sales Share column. Is there any measure to get the NEW RANK column for these stores? If so, how could it be?

 

Thanks in advance.

4 REPLIES 4
v-eqin-msft
Community Support
Community Support

Hi @Alistar45 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi  @Alistar45 ,

 

Based on this: Let's say the top 20% gets a letter, middle 50% gets another letter so and so. 

How about trying this:

Measure = 
var _c= COUNTROWS(ALL('Table'))
return  SWITCH(TRUE(), MAX('Table'[RANK])<=_c *0.2 , "A", MAX('Table'[RANK])<=_c *0.5,"B", "C")

Eyelyn9_0-1656491028006.png

 

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

Hariharan_R
Solution Sage
Solution Sage

Hi @Alistar45 

Try the below to get the new rank column. You can adjust the range.

 

 

New Rank =
SWITCH (
    TRUE (),
    'Table'[SALES SHARE] <= 0.02, "C",
    'Table'[SALES SHARE] <= 0.07, "B",
    'Table'[SALES SHARE] <= 0.12, "A",
    "S"
)

 

Thanks

Hari

Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


My Blog :: YouTube Channel :: My Linkedin


Sorry,

 

I didn't put a more detailed example of what i want.

 

For a better view, see this table:

 

CHAINSTORESELL OUTRANKSALES SHARENEW RANK
CHAIN TSTORE T$37,123.00117%A
CHAIN TSTORE I$21,589.23210%A
CHAIN TSTORE D$19,160.2439%B
CHAIN TSTORE M$17,194.4648%B
CHAIN TSTORE O$16,825.5958%B
CHAIN TSTORE E$16,220.8667%B
CHAIN TSTORE P$16,138.4277%B
CHAIN TSTORE B$14,516.1987%B
CHAIN TSTORE H$13,962.3496%B
CHAIN TSTORE S$11,264.14105%B
CHAIN TSTORE L$8,764.46114%C
CHAIN TSTORE A$8,421.58124%C
CHAIN TSTORE L$6,244.84133%C
CHAIN TSTORE F$2,397.52141%C
CHAIN TSTORE Q$1,888.84151%C
CHAIN TSTORE C$1,779.78161%C
CHAIN TSTORE G$1,449.52171%C
CHAIN TSTORE R$1,140.46181%C
CHAIN TSTORE N$1,023.67190%C
CHAIN TSTORE J$881.72200%C
CHAIN TSTORE K$388.97210%C

 

As you can see, the more values i have, the harder it gets to make a condition for every single percentage. Is there a way to make a condition for a group of percentage? Let's say the top 20% gets a letter, middle 50% gets another letter so and so.

 

Thanks!

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 MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.