> ## Content Index
> Fetch the complete content index at: https://abundance.alloconomy.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Allocate one carrier bill to two lines
- URL: https://abundance.alloconomy.com/alloconomy/de-interview-allocate-one-carrier-bill-to-two-lines/
- Published: 2026-11-22T05:08:03.000Z
- Updated: 2026-11-22T16:31:33.000Z
- Description: Three eligible order lines share a $10 carrier charge equally.
- Author: Sathya Narayanan
- Tags: Alloconomy, Data Engineering, Data Engineering Interview Field Guide, #web-only, #series-detail, #Import 2026-11-21 19:24, Combining facts and reconciling measures

1. [Collection · 10 seriesThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)
2. [Series opening · 3 essaysCombining facts and reconciling measuresSeries 6 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-compare-shipments-and-refunds-without-multiplying-either/)
3. This essay2 of 3

Data engineering · 3 essays

Combining facts and reconciling measures

Complete reading path · You are in Part 2 of 3
1. Part 1[Compare shipments and refunds without multiplying either](https://abundance.alloconomy.com/alloconomy/de-interview-compare-shipments-and-refunds-without-multiplying-either/)An order has two dispatches worth $80 and $40 and three refunds of $5, $7, and $8.
2. Part 2**Allocate one carrier bill to two lines**Current essayThree eligible order lines share a $10 carrier charge equally.
3. Part 3[Give a correction somewhere to go](https://abundance.alloconomy.com/alloconomy/de-interview-give-a-correction-somewhere-to-go/)May’s shipment report estimated $12 of freight.

## The interview prompt

Three eligible order lines share a $10 carrier charge equally. The result must be in whole cents, remain stable on rerun, and reconcile to the original invoice. Which line gets the extra cent?

## Make rounding as reproducible as the allocation

Calculate the pool in integer cents. With three equal weights, each exact share is 333⅓ cents. The floor of each share is 333 cents, leaving a one-cent residual. One defensible rule distributes residual cents in descending order of fractional remainder, breaking ties by stable line ID. Under ascending IDs A, B, and C, the results are $3.34, $3.33, and $3.33\. Changing database row order should not move a cent between lines.

For unequal weights, retain the original driver values and identify which lines were eligible before rounding. Compare their sum with the denominator used. If all weights are zero, division is undefined. Record an unallocated pool or use a business-approved fallback with a distinct rule version. Avoid silently assigning the charge to whichever line was loaded first.

A result can reconcile to the cent while answering the wrong economic question. A flat per-parcel carrier fee might be split by weight for financial reporting. To decide whether to add a book to an already-paid parcel, you need the incremental charge under the actual tariff. Carry the invoice reference through both analyses and explain which costs were observed and which shares were assigned.

## The model behind the answer

Suppose a different order contains a book and a classroom map. The carrier bills $15 for the parcel. The packed items weigh one and four kilograms. The invoice establishes parcel cost. It says nothing about either line’s individual cost.

If Maya approves weight as the allocation basis, the lines receive $3 and $12\. Keep the invoice-line identity, the input weights, the rule version, and any rounding treatment with the result. Reconcile the allocated $15 back to the billed $15\. When weights are missing, expose the unassigned amount or apply an agreed fallback. A tidy zero would make missing evidence look like free freight.

The warehouse may split costs by weight while a pricing analyst wants the incremental cost of adding one more book. Those are different questions. The carrier’s pricing curve might make the extra book nearly free. A defensible allocation answers how the company distributed a charge and leaves the marginal-cost question visible. [Kimball on allocated facts](https://www.kimballgroup.com/data-warehouse-business-intelligence-resources/kimball-techniques/dimensional-modeling-techniques/allocated-fact/?ref=abundance.alloconomy.com) · [Why Unit Economics?](https://abundance.alloconomy.com/alloconomy/why-unit-economics/)

## Try it in SQLite

Account for the final cent

Split 1,000 cents among three lines. Compare independent rounding with a deterministic remainder rule, then change the weights.

Tables and sample dataExample query Your SQL

Run SQLStopReset example

Each run starts with fresh sample data. Use Ctrl+Enter or ⌘+Enter to run. Only your browser processes the query.

Label Measure 

## Review the residual cent as a release decision

Ask the agent to implement the approved allocation in integer cents and show the allocation rule version on each line. A reviewer shuffles the three equally weighted lines before rerunning the $10 fixture.

**Reviewer decision.** A, B and C must receive 334, 333 and 333 cents under the stated tie-break. Then set all weights to zero. The whole 1,000 cents must remain accounted for under the agreed exception policy. Finance chooses the driver and the fallback. Passing a sum check alone cannot settle either decision.

*Further reading.* [The Data Warehouse Toolkit](https://www.amazon.com/dp/1118530802?ref=abundance.alloconomy.com), 3rd ed., on allocating header charges using business rules.

## One more question

The carrier later issues a $1 credit. Recompute the original allocation or record the credit separately?

Check your reasoning

Preserve the original invoice and credit identities. A current net-cost view may reallocate the $9 net pool under its rule. An issued period report may require an explicit credit and a new adjustment allocation. Test that each document and the net position reconcile under the chosen policy.

1. [Back to the series openingCombining facts and reconciling measuresSeries 6 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-compare-shipments-and-refunds-without-multiplying-either/)
2. [Explore the collectionThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)

[Previous · Compare shipments and refunds without multiplying either](https://abundance.alloconomy.com/alloconomy/de-interview-compare-shipments-and-refunds-without-multiplying-either/) · [Next · Give a correction somewhere to go](https://abundance.alloconomy.com/alloconomy/de-interview-give-a-correction-somewhere-to-go/) · [Complete series map](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)