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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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  @Anonymous,

 

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
Anonymous
Not applicable

Can anyone help on above please?

Hi  @Anonymous,

 

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!

Anonymous
Not applicable

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

Gabriel_Walkman
Continued Contributor
Continued Contributor

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

Anonymous
Not applicable

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
Anonymous
Not applicable

Can anyone please help?

Hi  @Anonymous ,

 

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!

 

 

Anonymous
Not applicable

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")
Anonymous
Not applicable

SampleDatapic.PNG

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors