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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Gr8apmech
Helper I
Helper I

How to rank multiple suppliers based on 3 measured values

With the communitie's help i have created a robust supplier dashboard to help the department manage supplier performance.  Now i need help to rank each supplier based on 3 different measures.  (defect per unit (DPU), On Time Delivery (OTD), and Spend $.  Adding spend will help us focus on the higher spend suppliers vs someone we spent $2.00 on and didn't come in on time.

 

Currently i am ranking using the following formula:

Ranking = RANKX(ALLSELECTED('ApprovedSupplierList'),[Performance],,DESC,Dense)
Performance = CALCULATE([Supplier OTD] - [DPU]*.0000000001)

 

My data looks like this sample:

SupplierDPUOTD Spend
A10000000.0% $37,776.00
B176470.58820.0% $464,242.00
C166666.66670.0% $4,452.30
D38461.538460.0% $2,780,000.00
E19047.619050.0% $9,300.00
F15267.175570.0% $50,437.20
G3333.3333330.0% $7,989.00
H371.05751390.0% $7,653.80
I00.0% $20.00
J25000025.0% $70,170.00
K43478.2608725.0% $47,907.98
L025.0% $7,583.00
M045.3% $123,761.88
N13953.4883746.2% $394,198.97
O50000050.0% $111,634.00
P7299.27007350.0% $16.00
Q3300.33003350.0% $23,510.80
R050.0% $13,822.00
S52631.5789577.8% $15,660.00
T4672.89719678.6% $67,939.96
U9950.24875680.0% $20,337.68
V080.0% $2,005.83
W081.3% $6,883.60
X52631.5789583.3% $6,024.62
Y083.3% $13,681.00
Z083.3% $20,326.70
AA087.5% $24,364.12
BB088.7% $308,800.05
CC088.9% $967.00
DD088.9% $1,490.05
EE43165.4676389.3% $129,184.00
FF089.5% $20,075.72
GG091.1% $127,741.80
HH091.3% $163,576.24
II091.7% $19,000.13
JJ092.3% $15,462.00
KK092.3% $12,265.50
LL333.889816492.5% $126,174.08
MM093.3% $20,416.00
NN093.8% $5,708.60
OO093.9% $359,017.48
PP77.6518092994.9% $150,715.63
QQ91.4662032496.0% $319,649.38
RR096.3% $9,285.72
SS096.5% $79,017.56
TT17142.8571497.7% $40,516.79
UU098.6% $21,029.97
VV1500000100.0% $443,657.26
WW66666.66667100.0% $2,774.25
XX66666.66667100.0% $3,208,300.00
YY62500100.0% $7,354.00
ZZ0100.0% $7,190.00

 

I would like to see a ranking of each supplier based on the three collumns (DPU, OTD, Spend) in sequential order, no ties.

SupplierDPUOTD SpendRanking
A10000000.0% $37,776.0010
B176470.58820.0% $464,242.0011
1 ACCEPTED SOLUTION

Ah, that's the part I missed.  You cannot measure a measure. You need to materialize these before you can rank them.

 

Here is the materialized version

 

r2 = rank(DENSE,ADDCOLUMNS(SUMMARIZE(ALLSELECTED('Table'),[Supplier]),"DPU",CALCULATE([_DPU]),"OTD",CALCULATE([_OTD]),"Spend",CALCULATE([_Spend])),ORDERBY([DPU],desc,[OTD],desc,[Spend],desc))

View solution in original post

14 REPLIES 14
Ashish_Mathur
Super User
Super User

Hi,

Use the RANK function.  In the third argument ORDERBY, you can specify multiple measures that you want to rank by.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur is correct, this is a much better approach. No need for a relation either.

 

lbendlin_0-1726932894971.png

 

You see the red squigglies - that is a bug in Power BI. ("Cannot find name") - you can ignore that

 

r = rank(DENSE,orderby('Table'[DPU],DESC,'Table'[OTD],DESC,'Table'[ Spend],DESC))

 

Getting an error on the first measure stating "Column 'DPU' in table 'Measure' can not be found or may not be used in this expression."

 

This is why i was using Rankx in my original formual.  Tried Rankx and it does not like the order of the variables (Dense, orderby, etc).  Other thoughts welcome!

Please don't name your tables "Measure". That is a reserved word.

Renamed table to Formulas and same result:

r = rank(DENSE,orderby('Formulas'[DPU],DESC,'Formulas'[Supplier OTD],DESC,'Delivery'[Line Total Amount],DESC))
 
Error "Column 'DPU' in table 'Formulas' cannot be found or may not be used in this expression."

What Power BI Desktop version are you using?  There were recent changes in the RANK function.

Version: 2.132.1053.0 64-bit (August 2024)

Are these columns actual columns or are some of them measures?

 

See attached - works for me with columns.

They are 3 different measures.

 

If i knew how, i would create a new table that captured these calculated values each month automatically.  Then i could use that table to perform the rank from?  does this sound do-able?

 

Ah, that's the part I missed.  You cannot measure a measure. You need to materialize these before you can rank them.

 

Here is the materialized version

 

r2 = rank(DENSE,ADDCOLUMNS(SUMMARIZE(ALLSELECTED('Table'),[Supplier]),"DPU",CALCULATE([_DPU]),"OTD",CALCULATE([_OTD]),"Spend",CALCULATE([_Spend])),ORDERBY([DPU],desc,[OTD],desc,[Spend],desc))

BINGO!

 

Perfect solution sir!  You've helped me several times and I really appreciate your knowledge and experience.  

Thanks go to @Ashish_Mathur for suggesting to use RANK.

You are welcome. @lbendlin .  You deserve the kudos because you helped the OP all the way through.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

MultiRank = 
var ms=maxx(all('Table (3)'[Spend]),[Spend])
var v = (sum('Table (3)'[DPU])+sum('Table (3)'[OTD]))*ms+sum('Table (3)'[Spend])
var t = addcolumns(allselected('Table (3)'[Supplier]),"v",calculate((sum('Table (3)'[DPU])+sum('Table (3)'[OTD]))*ms+sum('Table (3)'[Spend])))
return rankx(t,[v],v,DESC,Dense)

lbendlin_0-1726870189820.png

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors