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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
addicted87
Helper I
Helper I

Rank by expenses

Hey @all,

 

yet another problem:

 

I'd like to calculate a rank for a supplier by expenses in comparison to the competitors.

There are 5 suppliers (A,B,C,D,E) in 6 regions (R1,R2,R3,R4,R5,R6) producing 10 products (P1,P2...P10). Each supplier produces each product in each region.

 

Now I need a table, where I just want to show up the combination of region and product (I created a combined column regions_product and the rank of supplier A. I dont need the other ranks of the competitors, just the rank for supplier A in each row

 

 

For Example:

 

Region_ProductRank supplier A
R1_P12
R1_P25
R1_P35
R1_P41
......

 

 

Well, if I put the supplier in this table as well and select one special region_product combination, my current formula works:

 

rank by expenses =

RANKX(

            CALCULATETABLE(ALLSELECTED(table1[Region_Product];table1[supplier]));sum(table1[expenses))

 

Hope anyone can help me. THX 😉

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @addicted87 ,

 

Create a column as below:

Rankx = 
IF('Table'[Supplier]="A",RANKX(FILTER('Table','Table'[Region]=EARLIER('Table'[Region])&&'Table'[Supplier]=EARLIER('Table'[Supplier])),'Table'[Value],,ASC,Dense),BLANK())

And you will see:

v-kelly-msft_0-1613383374980.png

For the related sample .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @addicted87 ,

 

Create a column as below:

Rankx = 
IF('Table'[Supplier]="A",RANKX(FILTER('Table','Table'[Region]=EARLIER('Table'[Region])&&'Table'[Supplier]=EARLIER('Table'[Supplier])),'Table'[Value],,ASC,Dense),BLANK())

And you will see:

v-kelly-msft_0-1613383374980.png

For the related sample .pbix file,pls see attached.

 

Best Regards,
Kelly

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

lbendlin
Super User
Super User

you're holding the problem wrong. What you actually want to do is calculate the rank by supplier for the other categories. Product and region are irrelevant for the issue - the measure will take care of them for you.

What you cannot drop is the data for the other suppliers. If you do that then the ranking will no longer work as you would only compare supplier a to themselves.

 

Please provide sample data in usable format (not as a picture).

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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