Logistics & Transportation Analytics · Mission 9 of 30Medium

In-full rate by carrier

Compute a conditional rate using CASE WHEN on two columns compared

The Brief

Priya KapoorFreight Finance Leadlogistics-ops

In-full rate next — that's the share of shipments where `qty_shipped = qty_ordered`. Compute it per carrier across ALL shipments (not just delivered), label it `infull_rate`, round to 4 decimal places. Include total_shipments. Sort by infull_rate ascending.

You'll practice

CASE WHENORDER BYROUND

Tables & columns available

fact_shipmentsfact15 columns
ColumnTypeKey
shipment_idINTPK
carrier_idINTFK → dim_carriers
lane_idINTFK → dim_lanes
planned_pickup_dateTEXT
actual_pickup_dateTEXT
planned_delivery_dateTEXT
actual_delivery_dateTEXT
qty_orderedINT
qty_shippedINT
weight_lbsREAL
freight_costREAL
fuel_surchargeREAL
accessorial_costREAL
dwell_hours_at_originREAL
statusTEXT
dim_carriersdim6 columns
ColumnTypeKey
carrier_idINTPK
carrier_nameTEXT
scacTEXT
modeTEXT
on_time_target_pctREAL
hq_stateTEXT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

In-full = qty_shipped equals qty_ordered. Use CASE WHEN qty_shipped = qty_ordered THEN 1.0 ELSE 0.0 END inside AVG.

Hint 2

No status filter this time — compute across all shipments in the table.

Hint 3

GROUP BY carrier_name, sort by infull_rate ASC.