cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Apurvamah28
Helper I
Helper I

How to measure Rank based on two measures where one measure is string and another is numeric?

Hi All,

 

I have mulitple measures against a column in my table visual in Power BI. One such column is group column which groups the product as Group A, Groupb and so on.. Another measure is Total sales. So, if i want to rank my Product name column based on Group measure and Total Sales, how shall I do that? I'm only able to retreive ranking on the basis of Total sales

1 ACCEPTED SOLUTION

Hi  @Apurvamah28,

 

Create a column as below:

Group rank = RANKX(FILTER(ALL('Table'),'Table'[Product Groups]=EARLIER('Table'[Product Groups])),'Table'[ Shipped-Issues],,DESC,Dense)

And you will see:

vkellymsft_0-1624007200275.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

9 REPLIES 9
Apurvamah28
Helper I
Helper I

Can anyone help on above please?

Hi  @Apurvamah28,

 

Create a column as below:

Group rank = RANKX(FILTER(ALL('Table'),'Table'[Product Groups]=EARLIER('Table'[Product Groups])),'Table'[ Shipped-Issues],,DESC,Dense)

And you will see:

vkellymsft_0-1624007200275.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

Thanks a ton 🙂 This is what i wished to achieve. Have a nice day!

Gabriel_Walkman
Resolver III
Resolver III

Rank on the basis of total sales. Then just pull group as the legend or x-axis or something on the visual?

Need it on table visual, ranking isn't moving with respect to group measure (Product Groups). 
Consider the attached sample : Trying to rank on basis of Shipped - Issues Raised

RANK = CALCULATE(RANKX(CROSSJOIN(ALLSELECTED(Product_Table[ProductID]),ALL(Product_Table[ProductName])),[Shipped - Issues],,DESC,Dense))
 
Product Groups  ProductName  ProductID  OrdersRecd  OrdersShipped  Ratio   Issues  Shipped-Issues
A                           Product 62       101             1                    1                          100%   0           1     
B                           Product 15       302             3                     3                         100%   0           3     
C                           Product 38       746             1                    1                          100%   0           1     
A                           Product 10       101             1                    1                          100%     0           1     
B                           Product 17       155            86                  63                        73.2%     7          56     
C                           Product 4         140            22                  15                        68.1%      8           7     
A                           Product 6         250           107                 60                         56.07%   3          57     
 
Please note only Product ID and Product Name are existing columns, rest are calculated measures

Can anyone please help?

Hi  @Apurvamah28 ,

 

Could you pls provide an expected output based on your sample data ?

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

 

Please check below table, I want output to come as below. Also note for Groups I craeted measure as

 

Product Groups = 

SWITCH(TRUE(),
[Received]<=20,"C",
[Received]<=50,"B",
[Received]>50,"A")

SampleDatapic.PNG

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors