Historical Margin Backfill Pilot · sample output

The five outputs, using the five fictional rows of the published data contract

This is a static sample: the same numbers you get from contracts/receipts_template.csv and contracts/order_lines_template.csv. It shows the format and the reconciliation, not a real store's margin. Your files, your store, your numbers.

Fictional data. SKUs, dates and amounts come from the published template. Nothing here is a customer result, and no figure has been adjusted to look better.

Method declared: weighted average cost (WAC) by SKU and date. A sale takes the cost true on its date; nothing that happens later rewrites it. Currency USD · Timezone UTC.

1. cost_timeline.csv

skureceived_atqtylanded_unit_costwac_after
APP-TEE-BLK-M2025-01-151209.7000009.700000
APP-TEE-BLK-L2025-01-15809.7000009.700000
APP-HOOD-GRY-M2025-02-036016.40833316.408333
APP-HOOD-GRY-L2025-02-034016.57500016.575000
APP-CAP-OS2025-02-202003.7500003.750000

landed_unit_cost = unit_product_cost + (inbound_shipping_total + duties_total + other_landed_total) / quantity_received

2. margin_by_order.csv

order_refprocessed_atskuqty_netnet_salescogsmarginmargin_pctcoverage
SO-10012025-03-02APP-TEE-BLK-M258.0019.40000038.60000066.55 %full
SO-10022025-03-02APP-HOOD-GRY-L157.6016.57500041.02500071.22 %full
SO-10032025-03-05APP-CAP-OS124.003.75000020.25000084.38 %full
SO-10042025-03-11APP-TEE-BLK-L258.0019.40000038.60000066.55 %full
SO-10052025-03-14APP-HOOD-GRY-M164.0016.40833347.59166774.36 %full

net_sales = gross_sales − discounts − refund_amount · qty_net = quantity_sold − returned_quantity

3. margin_by_sku_month.csv

skumonthunits_netnet_salescogsmarginmargin_pct
APP-CAP-OS2025-03124.003.75000020.25000084.38 %
APP-HOOD-GRY-L2025-03157.6016.57500041.02500071.22 %
APP-HOOD-GRY-M2025-03164.0016.40833347.59166774.36 %
APP-TEE-BLK-L2025-03258.0019.40000038.60000066.55 %
APP-TEE-BLK-M2025-03258.0019.40000038.60000066.55 %

4. exceptions.csv

row_sourcerow_refskureason
———no exceptions in this sample

Reasons that appear in real files: sale before the first receipt, negative inventory, duplicate or ambiguous SKU, a different currency, an unlinked refund. An exception is listed, never dropped.

5. reconciliation.md

Method  : WAC by SKU and date · Currency: USD · Timezone: UTC (declared)
Inputs  : 5 order rows, 5 receipts
Outputs : 5 processed, 0 exceptions (100 % accounted, 0 silent drops)
Totals  : gross 297.00 · discounts 6.40 · refunds 29.00 · net 261.60
COGS    : 75.533333 · Margin 186.066667 (71.13 %)
Auto-mapping: 100 % of rows (contractual threshold to count as an app signal: ≥90 %)
Declared exclusions: none