Most distributors know their gross margin by customer. Far fewer know what it costs to serve each customer, and that is where profitable-looking accounts turn out to lose money. The most useful place to measure cost to serve is the invoice line, because that is where the work happens: every line is picked, checked and billed.
This article walks through one real calculation, from a sales rep's cost down to individual invoice lines, with numbers you can check on a calculator.
Start with the cost you want to spread
Take one sales rep, R-101, whose cost for August is 466,023.87. That figure already includes the rep's share of the sales cost centers, allocated by salary in an earlier stage. The question now is how much of it each invoice line should carry.
R-101 raised four invoices that month:
| Invoice | Lines |
|---|---|
| INV-9001 | 1 |
| INV-9002 | 6 |
| INV-9003 | 3 |
| INV-9004 | 12 |
| Total | 22 |
Why "cost per line" alone is wrong
The simplest approach divides the cost by 22 lines. That treats a one-line order and a twelve-line order as equally efficient per line, which they are not. Every invoice carries fixed effort, whatever its size: the order is entered, credit is checked, the paperwork is raised and the delivery is booked. A twelve-line order spreads that effort over twelve lines; a one-line order puts all of it on one.
Use a composite weight
A composite weight captures both kinds of effort. In this model:
- each line counts as 1, for the line-level work;
- each invoice header counts as 4, spread evenly across its lines.
So the weight of one line is 1 + 4 / (lines on the invoice).
| Invoice | Lines | Weight per line | Invoice weight |
|---|---|---|---|
| INV-9001 | 1 | 5.000000 | 5 |
| INV-9002 | 6 | 1.666667 | 10 |
| INV-9003 | 3 | 2.333333 | 7 |
| INV-9004 | 12 | 1.333333 | 16 |
| Total | 22 | 38 |
Turn weights into money
Divide the cost by the total weight to get a rate per weight point:
466,023.87 / 38 = 12,263.7862 per point
Then multiply each line's weight by the rate:
| Invoice | Cost per line |
|---|---|
| INV-9001 | 61,318.93 |
| INV-9002 | 20,439.64 |
| INV-9003 | 28,615.50 |
| INV-9004 | 16,351.71 |
Rounding to the cent without losing a cent
Twelve lines at 16,351.7147 each do not round to a total that matches the source exactly. Rounding every line down loses cents; rounding every line up invents them. The fix is largest-remainder rounding: round every line down, then give the leftover cents one at a time to the lines with the largest remainders. The allocated amounts then add back to 466,023.87 exactly, and the reconciliation to the ledger holds to the cent.
What the answer tells you
Compare a line on the one-line invoice with a line on the twelve-line invoice:
(1 + 4) / (1 + 4/12) = 3.75
Each line of a one-line order carries 3.75 times the cost of a line on a twelve-line order. Customers who place many small orders cost far more to serve than their revenue suggests, and that difference is invisible in a gross margin report.
Putting it to work
With cost at line level, you can:
- rank customers by contribution after cost to serve, not by gross margin;
- set minimum order values or small-order charges based on evidence;
- see which reps carry the most expensive book of business;
- test the effect of a change in the weights, such as counting the header as 3 or 5, in a separate scenario before adopting it.
The weights are a choice, and the right values differ by business. What matters is that the choice is written down, applied consistently, and traceable from every line back to the ledger balance that funded it.