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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
WorldWide1
Helper I
Helper I

Calculation Help

Afternoon all --

Still new to PBI and have a project that is beyond me currently so any help would be appreciated.

Data I have contains Shipment numbers and origin and destination:

ShipmentIDOrigin StateOrigin ZipDest StateDest ZipLane
221676109CA90040PA18073CA-PA
222909285PA18073CO80125PA-CO
223286717PA18073CT06824PA-CT
223286766PA18073MA1240PA-MA
223370917PA18073RI02919PA-RI

 

and then for each of those shipments, I have a variety of Costs:

ShipmentIDSCACRate Type Cost  Cost Add-Ins Total  HC Total  Total Cost 
221676109ABFSB $         387.14 $                                       -   $                  -   $       387.14
221676109ABFSCC $         606.50 $                                90.00 $                  -   $       696.50
221676109CNWYB $         376.47 $                              125.00 $                  -   $       501.47
221676109CNWYCC $         598.13 $                                55.00 $                  -   $       653.13
222909285ABFSB $         948.94 $                                       -   $         200.00 $   1,148.94
222909285ABFSCC $     1,090.29 $                                       -   $                  -   $   1,090.29
222909285CNWYB $     1,398.21 $                                       -   $                  -   $   1,398.21
222909285CNWYCC $         996.60 $                                       -   $           75.00 $   1,071.60
222909285CTIIB $     1,509.64 $                                       -   $           95.00 $   1,604.64
222909285EXLAB $     1,490.09 $                                       -   $                  -   $   1,490.09
223286717SAIACC $         180.37 $                                       -   $                  -   $       180.37
223286717UPGFB $         200.91 $                                       -   $                  -   $       200.91
223286717UPGFCC $         234.72 $                                       -   $                  -   $       234.72
223286717WARDB $         142.38 $                                60.00 $                  -   $       202.38
223286717WARDCC $         177.47 $                                       -   $                  -   $       177.47
223286766ABFSB $         325.83 $                                       -   $                  -   $       325.83
223286766ABFSCC $         280.52 $                                       -   $                  -   $       280.52
223286766CNWYB $         320.61 $                                       -   $                  -   $       320.61
223286766CNWYCC $         249.80 $                                       -   $                  -   $       249.80
223286766SAIACC $         256.79 $                                       -   $                  -   $       256.79
223286766UPGFB $         202.47 $                                       -   $                  -   $       202.47
223286766UPGFCC $         234.72 $                                       -   $                  -   $       234.72
223370917ABFSB $         231.18 $                                       -   $                  -   $       231.18
223370917ABFSCC $         241.02 $                                       -   $                  -   $       241.02
223370917CNWYB $         175.57 $                                       -   $                  -   $       175.57
223370917CNWYCC $         206.60 $                                       -   $                  -   $       206.60

 

I need to do a few things w/this data:

1.  For each ShipmentID, find the lowest Total Cost and SCAC on each ShipID;

2.  Determine if any of the SCAC's w/Rate Type C are the lowest cost on any ID;

3.  Count the # of times a Rate Type C SCAC is lowest cost, by Lane;

4,  Make all of it subject to a filter where the user can include/exclude the pool of SCAC's;

5.  Analyze how each SCAC is doing (wins/lowest cost), by Lane, and have the visual show all Lanes, regardless of whether the SCAC we're analyzing has any wins.

 

In Tableau it looks like this:

WorldWide1_0-1743456942379.png

So, all Lanes and shipments are included in the view, subject to filtering by SCAC, and then the "Shipment Award" is arrived at by analyzing a single SCAC, for example while all of the SCAC's are included, we're only analyzing CNWYC in the above visual.

 

I hope all of that makes sense and I do appreciate any help on this.

Thank you.

 

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @WorldWide1  - Create a calculated column to get the lowest cost for each

 

MinTotalCost =
CALCULATE(
MIN(Shipments[Total Cost]),
ALLEXCEPT(Shipments, Shipments[ShipmentID])
)

 

another calculated column for loweest cost:

LowestCost =
IF(Shipments[Total Cost] = Shipments[MinTotalCost], 1, 0)

 

Check if a Rate Type "C" SCAC is the Lowest Cost

LowestCostRateC =
IF(
Shipments[IsLowestCost] = 1 && Shipments[Rate Type] = "C",
1,
0
)

now create a measure to count the ratetype c

 

RateC_Wins =
CALCULATE(
COUNT(Shipments[ShipmentID]),
Shipments[LowestCostRateC] = 1
)

 

Now apply the filter condition from param table:

RateC_Wins =
CALCULATE(
COUNT(Shipments[ShipmentID]),
Shipments[LowestCostRateC] = 1
)

 

hope this helps

 

 

 





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
rajendraongole1
Super User
Super User

Hi @WorldWide1  - Create a calculated column to get the lowest cost for each

 

MinTotalCost =
CALCULATE(
MIN(Shipments[Total Cost]),
ALLEXCEPT(Shipments, Shipments[ShipmentID])
)

 

another calculated column for loweest cost:

LowestCost =
IF(Shipments[Total Cost] = Shipments[MinTotalCost], 1, 0)

 

Check if a Rate Type "C" SCAC is the Lowest Cost

LowestCostRateC =
IF(
Shipments[IsLowestCost] = 1 && Shipments[Rate Type] = "C",
1,
0
)

now create a measure to count the ratetype c

 

RateC_Wins =
CALCULATE(
COUNT(Shipments[ShipmentID]),
Shipments[LowestCostRateC] = 1
)

 

Now apply the filter condition from param table:

RateC_Wins =
CALCULATE(
COUNT(Shipments[ShipmentID]),
Shipments[LowestCostRateC] = 1
)

 

hope this helps

 

 

 





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

Proud to be a Super User!





Thank you!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.