How to Calculate True Cost Per Unit and Set Margin With an AI Agent
Two in three firms hit by war-driven cost increases are absorbing some or all of them, the Bank of Canada found. Cost per unit now decides your margin.
A four-part method for building a cost-per-unit figure that survives scrutiny. It covers which costs to allocate, how to pick an allocation basis, how often to recompute, and what your data has to look like first.
Canadian businesses are being squeezed from a direction that makes pricing useless as a defence. The Bank of Canada's second-quarter survey found that nearly three-quarters of firms reported their costs had risen because of the war in the Middle East. Among those firms, "roughly 40% are not passing on and 25% are only partially passing on the increases to their customers" (Bank of Canada Business Outlook Survey, Q2 2026). Those two groups sum to roughly 65% of affected firms absorbing part or all of an increase into margin.
That statistic has a direct consequence. If you cannot reprice, every dollar of margin you keep is decided at the cost line. And for the quarter of firms passing costs on partially, there is a second decision hiding inside the first: which items get the increase and which absorb it. Both decisions run on the same input: a reliable cost per units.
What "true cost per unit" means
True cost per unit is the supplier invoice price plus every cost required to make that unit sellable and hold it until it sells. That includes inbound freight, duty and brokerage, shrink and returns, and the carrying cost of capital tied up in stock. The invoice price on its own records one thing: what you paid a supplier. Margin has to be set against the full figure.
The distinction matters because the components behave differently. Invoice price is per-unit and arrives with the purchase order. The others arrive later, often on separate documents, frequently in amounts that cover a whole shipment rather than a single line. A freight invoice for a mixed container is a single number attached to forty products.
That timing gap is the mechanical reason unit costs go stale. The receipt gets posted and the units go on the shelf and start selling. The charges that belong to them arrive a week later with no obvious place to go.
The four components most unit-cost figures leave out
Inbound freight and fuel surcharges. The Bank of Canada found that nearly three-quarters of firms saw costs rise on the back of the Middle East conflict, which moved this component sharply within a single quarter (Bank of Canada Business Outlook Survey, Q2 2026).
Duty, brokerage and customs handling. Tariff changes make this component volatile rather than fixed. The Bank noted in September that "new US tariffs and Canadian counter-tariffs will also raise costs for some businesses and could feed into consumer prices over time" (Bank of Canada, interest rate announcement, 2 September 2026).
Shrink, damage and returns. Units you paid for and cannot sell push their cost onto the units you can sell.
Carrying cost of capital. Stock is money you have already spent and cannot spend again. The floor on that cost is the policy rate, which the Bank held at 2.25% on 2 September (Bank of Canada, interest rate announcement, 2 September 2026). Most businesses borrow above it, so treat 2.25% as the minimum rather than the answer.
The capital component is small per unit and large in aggregate. Canadian wholesale inventories, excluding petroleum and grain, sat at $140.6 billion in July 2026, with an inventory-to-sales ratio of 1.51 months (Statistics Canada, Wholesale trade, July 2026). That is about six and a half weeks of sales held as capital across the sector at any moment.
Choosing an allocation basis
This is where the largest errors can hide. An $18,000 freight invoice covering a mixed shipment has to be split across the products in it, and the split you choose changes every margin number downstream.
| Allocation basis | Best for | Where it distorts |
|---|---|---|
| Per unit (divide by total units) | Shipments of similar items | Overcharges small light items, undercharges bulky ones |
| By weight | Freight-dominated costs | Wrong when a light item is the expensive one |
| By volume or cubic space | Container and LTL shipping | Needs dimensional data most systems do not hold |
| By invoice value | Duty, insurance, brokerage | Wrong for freight, where value and bulk diverge |
Match the basis to what actually drives the charge. Freight is driven by weight and space. Duty is driven by declared value. Applying one basis to both will still reconcile to the invoice total, which is why this error can survive review.
Not sure where AI fits in your operations?
Take the Free AI Readiness Scorecard →A worked example
Illustrative arithmetic for a wholesale distributor moving 40,000 units of one product line a year. Every figure below is invented for demonstration. DeployLabs has measured none of it with a client.
- Supplier invoice price: $12.00 per unit
- Inbound freight for the line: $18,000 a year, or $0.45 a unit
- Duty and brokerage: $9,600, or $0.24 a unit
- Shrink and damage at 1.8%: removes 720 units, and the $8,640 they cost spreads across the 39,280 that remain sellable, adding $0.22
- Carrying cost at the 2.25% policy-rate floor, on roughly 5,000 units of average stock: $0.03
True cost per unit: $12.94.
At a $16.00 selling price, the distributor believes margin is $4.00 a unit, or 25.0% (illustrative). Actual margin is $3.06, or 19.1% (illustrative). The gap is $0.94 a unit, which across 39,280 sellable units is $36,923 a year of margin that exists on the report and not in the bank.
The ranking matters more than the dollar figure. Once this line carries a true margin, it can be sorted against every other line, and that sort is what tells you which products absorb a cost increase and which pass it on.
How often the figure has to be rebuilt
A cost figure refreshed quarterly is accurate on the day it is built and decays from there. Freight rates, exchange rates and supplier surcharges all move faster than that. Somewhere inside the quarter you are pricing against a number you no longer have grounds to trust, and nothing in the spreadsheet tells you when you crossed that line.
An agent's advantage here is coverage. It recomputes every line in the catalogue against current inputs on a schedule and surfaces only the ones whose margin moved enough to matter. A capable analyst still beats it on any single calculation, which is the point: the analyst stops rebuilding the same spreadsheet and starts working a ranked exception list. That changes what your finance function can cover rather than changing who does the work.
Three conditions to meet first
First, the cost components have to exist somewhere machine-readable: freight invoices, brokerage statements and credit notes in a system rather than in an inbox.
Second, every charge needs a link back to the shipment it belongs to. If receiving skips this step, the link cannot be rebuilt reliably after the fact.
Third, somebody has to own the allocation rules. An agent will apply whatever basis you give it, consistently and forever. That is an advantage only if the basis is right, which is a judgement your team makes once and the agent then enforces.
Where this does not work
If your product mix is mostly services or made-to-order work with no held inventory, the carrying and shrink components fall away and the exercise collapses into standard job costing, which your accounting system likely handles already.
It also does not work where the underlying documents genuinely do not exist. If freight arrives as a monthly lump sum from a single carrier with no shipment-level detail, no amount of tooling will allocate it honestly. The fix there starts with a conversation with your carrier about shipment-level billing.
There is a broader version of this blind spot in the national data. Statistics Canada found that 19.2% of businesses used AI to produce goods or deliver services in the twelve months to the second quarter of 2026, up from 6.1% two years earlier. In the same release, 40.0% of businesses said AI use "is not relevant to the business" (Statistics Canada, Analysis on artificial intelligence use by businesses in Canada, Q2 2026). That survey ran from 1 April to 6 May 2026 and drew 9,251 responses from a sample of 21,105.
Read the question carefully and the 40.0% becomes less surprising. It asks about producing goods and delivering services. Costing falls outside both: it is the arithmetic that tells you whether producing the good was worth doing, and it sits outside the frame many owners use to judge whether any of this applies to them.
The one-question test
Before any of this becomes a project, answer one question about your own catalogue: can you currently rank your product lines by true margin, today, without rebuilding anything?
If yes, your costing is current enough and your next move is elsewhere. If answering would take a week, you have found the gap, and the three conditions above tell you which part of it to fix first.
- Roughly 65% of affected firms in the Bank of Canada's Q2 survey absorb part or all of a cost increase, which moves the margin decision from the price line to the cost line.
- Cost of goods is invoice price plus freight, duty, shrink and carrying cost.
- Match the allocation basis to what drives the charge: weight and volume for freight, declared value for duty.
- An agent's contribution here is catalogue-wide coverage on a schedule.
- Link every charge to its shipment at receipt time. That link cannot be rebuilt reliably later.