Problems / Normalize Mixed Units / Editorial
CASE
weight_unit
kg
lb
0.453592
g
1000
SUM
warehouse
ROUND(..., 2)
Unit normalization must happen before aggregation — summing raw weight_value across mixed units is meaningless. The second trap is rounding order: round-then-sum accumulates per-row rounding error, while sum-then-round keeps full precision until the very end. Boston in this dataset is the proof: its shipments sum to 21.696984 kg, which rounds to 21.70, but rounding each shipment first yields 21.69. Always round as late as possible.
weight_value
21.696984
21.70
21.69
Solve Normalize Mixed Units yourself →