Skip to main content

Cost Layer Rebuild: What It Does and Why It Matters

B
Written by Brendon Beebe
Updated over a week ago

The Cost Layer Rebuild process is like a nightly "accountant" that ensures your inventory costs are accurate and up-to-date. Think of it as a financial health check for your inventory that runs automatically to keep your cost tracking clean and reliable.

What Are Cost Layers?

Cost layers are records that track the true cost of every item in your inventory. This isn't just the purchase price you paid to your supplier - it includes:

  • Base purchase price from your supplier

  • Shipping and freight costs to get items to your warehouse

  • Customs duties and taxes for international shipments

  • Handling and processing fees

  • Other miscellaneous costs associated with receiving the items

Why Does This Process Run Nightly?

Over time, your cost data can become inconsistent due to:

  • Partial shipments being received at different times

  • Manual inventory adjustments made during the day

  • System updates or data imports

  • Complex transactions involving multiple warehouses

  • Corrections to previous entries

The nightly rebuild ensures that by morning, all your cost data is accurate and reflects reality.

What The Rebuild Process Does

1. Investigates Your Receiving History

The system looks at your actual receiving reports and purchase orders to understand:

  • What items were actually received (not just what was ordered)

  • When they were received

  • What additional costs were incurred for each shipment

2. Calculates True Item Costs

For each item, it:

  • Takes the base purchase price

  • Adds the appropriate share of shipping, duties, and other costs

  • Creates a weighted average cost when items came from multiple shipments

  • Ensures costs are allocated fairly across all items in a shipment

3. Cleans Up Inconsistencies

The process:

  • Removes old, incorrect cost records

  • Eliminates negative cost entries that shouldn't exist

  • Consolidates multiple cost records into clean, accurate ones

  • Ensures cost data matches your actual inventory levels

4. Distributes Costs Properly

  • Assigns the correct costs to each warehouse based on current stock levels

  • Ensures each location has accurate cost information

  • Maintains proper cost tracking across your entire operation

Business Benefits

Accurate Profitability Reports

With clean cost data, your profit margins and financial reports reflect reality, not outdated or incorrect cost information.

Better Inventory Valuation

Your inventory is valued at its true cost, giving you accurate balance sheet numbers for financial statements and tax purposes.

Reliable Cost Analysis

You can trust cost-based decisions like pricing, supplier evaluation, and product profitability analysis.

Clean Data Foundation

Eliminates the accumulation of data inconsistencies that can compound over time and cause reporting errors.

When You'd Notice the Benefits

  • Financial reports show consistent, logical cost progressions

  • Inventory valuations accurately reflect what you actually paid (including all costs)

  • Profit margin calculations are reliable and trustworthy

  • Cost-based alerts and automations work correctly

  • Accounting reconciliations are cleaner and easier

What Happens During the Process

The rebuild is designed to be:

  • Non-disruptive: Runs during off-hours when system usage is low

  • Comprehensive: Processes all items that need attention

  • Logged: Maintains a detailed audit trail of all changes made

  • Safe: Can be run in "preview mode" to see what would change before making actual updates

In Simple Terms

Think of this process as having a meticulous accountant who:

  1. Reviews all your receiving paperwork every night

  1. Calculates the true cost of every item (including shipping, duties, etc.)

  1. Updates your inventory records to reflect accurate costs

  1. Cleans up any mistakes or inconsistencies from the day

  1. Ensures your financial reports will be accurate in the morning

This automated process ensures that your cost tracking stays accurate without requiring manual intervention, giving you confidence in your financial data and inventory valuations.

Detailed Calculation Example

Let me walk you through a complex real-world scenario that shows exactly how the system calculates costs.

Scenario: International Shipment with Multiple SKUs

Background:

Your company receives a shipment from a Chinese supplier containing three different products, with various extra costs that need to be allocated properly.

Initial Purchase Order

SKU

Product

Ordered Qty

Unit Price

Line Total

12345

Widget A

1,000 units

$5.00

$5,000.00

12346

Widget B

500 units

$12.00

$6,000.00

12347

Widget C

200 units

$25.00

$5,000.00

Total

1,700 units

$16,000.00

Shipment Extra Costs

Cost Type

Amount

Allocation Method

Ocean Freight

$850.00

Unit-based

Customs Duty

$480.00

Value-based

Port Handling

$120.00

Unit-based

Total Extra Costs

$1,450.00

Actual Receipts (Partial Shipment)

Only 75% of the ordered quantity actually arrived:

SKU

Product

Received Qty

Unit Price

Line Total

12345

Widget A

750 units

$5.00

$3,750.00

12346

Widget B

375 units

$12.00

$4,500.00

12347

Widget C

150 units

$25.00

$3,750.00

Total

1,275 units

$12,000.00


Step-by-Step Cost Calculation

Step 1: Unit-Based Extra Cost Allocation (Ocean Freight + Port Handling)

Total Unit-Based Costs: $850.00 + $120.00 = $970.00

Total Units Received: 1,275 units

Cost Per Unit: $970.00 ÷ 1,275 = $0.7608 per unit

SKU

Received Qty

Unit-Based Cost

Total Unit-Based Cost

12345

750 units

$0.7608

$570.60

12346

375 units

$0.7608

$285.30

12347

150 units

$0.7608

$114.10

Total

1,275 units

$970.00

Step 2: Value-Based Extra Cost Allocation (Customs Duty)

Total Value-Based Costs: $480.00

Total Received Value: $12,000.00

Cost Per Dollar: $480.00 ÷ $12,000.00 = $0.0400 per dollar

SKU

Line Total

Value-Based Cost

Total Value-Based Cost

12345

$3,750.00

$0.0400

$150.00

12346

$4,500.00

$0.0400

$180.00

12347

$3,750.00

$0.0400

$150.00

Total

$12,000.00

$480.00

Step 3: Calculate Final Landed Cost Per Unit

SKU

Base Cost

Unit-Based Extra

Value-Based Extra

Total Extra

Final Unit Cost

12345

$5.00

$570.60 ÷ 750 = $0.7608

$150.00 ÷ 750 = $0.2000

$0.9608

$5.9608

12346

$12.00

$285.30 ÷ 375 = $0.7608

$180.00 ÷ 375 = $0.4800

$1.2408

$13.2408

12347

$25.00

$114.10 ÷ 150 = $0.7607

$150.00 ÷ 150 = $1.0000

$1.7607

$26.7607

Step 4: Weighted Average Calculation (if enabled)

If the system is configured for weighted average costing, it combines all shipment layers:

Total Quantity: 750 + 375 + 150 = 1,275 units

Total Cost: (750 × $5.9608) + (375 × $13.2408) + (150 × $26.7607) = $13,450.00

Weighted Average Cost: $13,450.00 ÷ 1,275 = $10.5490 per unit


Step 5: Distribution to Warehouses

Let's say the current stock levels are:

SKU

Warehouse

Current Stock

Percentage

12345

Warehouse A

600 units

80%

12345

Warehouse B

150 units

20%

12346

Warehouse A

225 units

60%

12346

Warehouse B

150 units

40%

12347

Warehouse A

150 units

100%

Final Cost Layer Creation

For SKU 12345 (Widget A):

  • Warehouse A: 600 units @ $5.9608 = $3,576.48

  • Warehouse B: 150 units @ $5.9608 = $894.12

For SKU 12346 (Widget B):

  • Warehouse A: 225 units @ $13.2408 = $2,979.18

  • Warehouse B: 150 units @ $13.2408 = $1,986.12

For SKU 12347 (Widget C):

  • Warehouse A: 150 units @ $26.7607 = $4,014.11

Key Benefits of This Approach

  1. Accurate Cost Allocation: Extra costs are distributed based on what was actually received, not what was ordered

  1. Fair Distribution: Different allocation methods ensure costs are assigned appropriately (freight by quantity, duty by value)

  1. Shipment-Level Accuracy: All costs for a shipment are considered together, preventing double-counting or missed costs

  1. Warehouse Precision: Costs are correctly assigned to where inventory actually sits

This detailed calculation ensures that your inventory valuation reflects the true landed cost of goods, including all associated expenses properly allocated across all received items.

What Happens When More Stock Is Received Later

Great question! Let me walk you through what happens when additional stock arrives after the initial cost layer rebuild. There are several scenarios to consider.

Scenario 1: Remaining Stock from Same Shipment Arrives

Let's continue with our previous example where we only received 75% of the original shipment.

Original Situation (from previous example):

  • Already received: 750 units of Widget A @ $5.9608 per unit

  • Still pending: 250 units of Widget A from the same shipment

When the Remaining 250 Units Arrive:

The system recognizes this as part of the same shipment because it has the same supplier_purchase_order_shipment_id.

Cost Calculation Process:

  1. Same Base Costs Apply: $5.00 per unit (same PO)

  1. Same Extra Costs Apply: The $1,450 in extra costs was already allocated to the full shipment

  1. Proportional Allocation: The 250 units get their proportional share of the already-calculated extra costs

text

Apply to RebuildCostL...

Unit-based extra costs: $0.7608 per unit (already calculated)

Value-based extra costs: $0.2000 per unit (already calculated)

Final cost per unit: $5.9608 (same as the first batch)

Result:

  • New cost layer created: 250 units @ $5.9608 = $1,490.20

  • Total cost layers for Widget A:

  • Layer 1: 750 units @ $5.9608 = $4,470.60

  • Layer 2: 250 units @ $5.9608 = $1,490.20

  • Combined: 1,000 units @ $5.9608 = $5,960.80


Scenario 2: Completely New Shipment Arrives

Now let's say 3 months later, you receive a new shipment of the same products but with different costs.

New Shipment Details:

SKU

Product

Received Qty

New Unit Price

Line Total

12345

Widget A

500 units

$5.50

$2,750.00

12346

Widget B

300 units

$13.00

$3,900.00

New Shipment Extra Costs:

Cost Type

Amount

Allocation Method

Ocean Freight

$600.00

Unit-based

Customs Duty

$265.00

Value-based

Total Extra Costs

$865.00

Cost Calculation for New Shipment:

Unit-based costs: $600.00 ÷ 800 units = $0.75 per unit

Value-based costs: $265.00 ÷ $6,650.00 = $0.0399 per dollar

For Widget A (SKU 12345):

  • Base cost: $5.50

  • Unit-based extra: $0.75

  • Value-based extra: ($2,750.00 × $0.0399) ÷ 500 = $0.2197

  • Final cost: $6.4697 per unit


How the System Handles Multiple Cost Layers

FIFO (First-In, First-Out) Method:

The system maintains separate cost layers for each receipt:

Widget A Cost Layers:

  1. Layer 1: 750 units @ $5.9608 (from original shipment)

  1. Layer 2: 250 units @ $5.9608 (remaining from original shipment)

  1. Layer 3: 500 units @ $6.4697 (from new shipment)

When items are sold/consumed:

  • First 750 units cost $5.9608 each

  • Next 250 units cost $5.9608 each

  • Next 500 units cost $6.4697 each

Weighted Average Method:

The system combines all layers into one average cost:

Calculation:

text

Apply to RebuildCostL...

Total quantity: 750 + 250 + 500 = 1,500 units

Total cost: (750 × $5.9608) + (250 × $5.9608) + (500 × $6.4697) = $9,194.30

Weighted average: $9,194.30 ÷ 1,500 = $6.1295 per unit

Result: Single cost layer of 1,500 units @ $6.1295 per unit


Impact on Existing Inventory

Before New Receipt:

Warehouse

Quantity

Cost per Unit

Total Value

Warehouse A

800 units

$5.9608

$4,768.64

Warehouse B

200 units

$5.9608

$1,192.16

Total

1,000 units

$5,960.80

After New Receipt (FIFO):

Warehouse

Layer 1

Layer 2

Total Value

Warehouse A

800 units @ $5.9608

200 units @ $6.4697

$6,062.58

Warehouse B

200 units @ $5.9608

300 units @ $6.4697

$3,133.23

Total

1,000 units

500 units

$9,195.81

After New Receipt (Weighted Average):

Warehouse

Quantity

New Avg Cost

Total Value

Warehouse A

1,000 units

$6.1295

$6,129.50

Warehouse B

500 units

$6.1295

$3,064.75

Total

1,500 units

$9,194.25


What the Nightly Rebuild Process Does

For FIFO Systems:

  1. Preserves layer integrity: Each receipt maintains its own cost layer

  1. Maintains chronological order: Layers are consumed in the order they were received

  1. Cleans up any inconsistencies: Ensures layers match actual inventory levels

For Weighted Average Systems:

  1. Recalculates the average: Combines all receipts into a single weighted average

  1. Updates all cost layers: Replaces multiple layers with one unified cost

  1. Redistributes to warehouses: Allocates the average cost based on current stock levels

Did this answer your question?