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
HDD009
Frequent Visitor

Determine cheapest supplier and and calculate saving potential

Good day,

 

after the good experience of my last post I will try it again with my next issue that I am working on.

Data looks like this:

SupplierFromToTransport VolumeTransport CostWeekMonthYear
Supplier ANorthSouth1401,48112019
Supplier ANorthSouth1401,48212019
Supplier BNorthSouth1525,68112019
Supplier CNorthSouth1530,11112019
Supplier DNorthSouth1540,28112019
Supplier CNorthSouth1530,11212019
Supplier AWestNorth1222,22112019

 

I have a list of suppliers on a already filtered corridor level (North to South) of Month 01 of Year 2019.

SupplierFromToTransport VolumeTransport CostWeekMonthYear
Supplier ANorthSouth1401,48112019
Supplier ANorthSouth1401,48212019
Supplier BNorthSouth1525,68112019
Supplier CNorthSouth1530,11112019
Supplier DNorthSouth1540,28112019
Supplier CNorthSouth1530,11212019

 

And what I want to show is this:

SupplierFromToTransport VolumeTotal CostsUnit CostsCheapestUnit Costs Cheapest SupplierCost differenceTotal Difference
Supplier ANorthSouth2802,96401,48Supplier A401,4800
Supplier BNorthSouth1525,68525,68Supplier A401,48124,2124,2
Supplier CNorthSouth21060,22530,11Supplier A401,48128,63257,26
Supplier DNorthSouth1540,28540,28Supplier A401,48138,8138,8
Total        520,26

 

Maybe someone of you knows how to solve this challenge.

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @HDD009 ,

 

Try to change it in DAX below.

 

Cheapest = CALCULATE(MIN(Table1[Supplier]),FILTER(ALLSELECTED(Table1),Table1[From]=MAX(Table1[From])&&Table1[To]=MAX(Table1[To])&&Table1[Year]=MAX(Table1[Year])&&Table1[Month]=MAX(Table1[Month])&&Table1[Transport Cost]=Table1[Unit Costs Cheapest Supplier]))
 

Best Regards,

Amy

 

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

View solution in original post

3 REPLIES 3
v-xicai
Community Support
Community Support

Hi @HDD009 ,

 

You can create measure using DAX below.

 

Total Costs = SUM(Table1[Transport Cost])

 

Unit Costs = MAX(Table1[Transport Cost])

 

Cheapest = CALCULATE(MIN(Table1[Supplier]),FILTER(ALLSELECTED(Table1),Table1[From]=MAX(Table1[From])&&Table1[To]=MAX(Table1[To])&&Table1[Year]=MAX(Table1[Year])&&Table1[Month]=MAX(Table1[Month])))

 

Unit Costs Cheapest Supplier = CALCULATE(MIN(Table1[Transport Cost]),FILTER(ALLSELECTED(Table1),Table1[From]=MAX(Table1[From])&&Table1[To]=MAX(Table1[To])&&Table1[Year]=MAX(Table1[Year])&&Table1[Month]=MAX(Table1[Month])))

 

Cost difference = Table1[Unit Costs]-Table1[Unit Costs Cheapest Supplier]

 

Total Difference = SUM(Table1[Transport Volume])*Table1[Cost difference]

 

 

2.png

 

Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ETcmfLqFfXhJnL5yd1...

 

Best Regards,

Amy

 

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

 

Hi @v-xicai I think that's it.

 

There is only one thing:

Cheapest = CALCULATE(MIN(Table1[Supplier]),FILTER(ALLSELECTED(Table1),Table1[From]=MAX(Table1[From])&&Table1[To]=MAX(Table1[To])&&Table1[Year]=MAX(Table1[Year])&&Table1[Month]=MAX(Table1[Month])))

 

Shows only the min supplier (In this case it's sorting by the alphabet: A) not the cheapest supplier. What do i need to modify in this case?

v-xicai
Community Support
Community Support

Hi @HDD009 ,

 

Try to change it in DAX below.

 

Cheapest = CALCULATE(MIN(Table1[Supplier]),FILTER(ALLSELECTED(Table1),Table1[From]=MAX(Table1[From])&&Table1[To]=MAX(Table1[To])&&Table1[Year]=MAX(Table1[Year])&&Table1[Month]=MAX(Table1[Month])&&Table1[Transport Cost]=Table1[Unit Costs Cheapest Supplier]))
 

Best Regards,

Amy

 

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

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.

Top Solution Authors