Understanding Weighted Average Cost (WAC)
AccuArk uses Weighted Average Cost (WAC) to automatically maintain accurate item costs as you receive inventory at different prices over time. This guide explains the formula, when it runs, how to override it, and how cost flows through the system.
What Is Weighted Average Cost?
Weighted Average Cost is a costing method that calculates the average cost of an item by weighing the cost of existing stock against the cost of newly received stock. Unlike FIFO or LIFO, WAC blends all purchase costs together into a single average.
This means your item's cost always reflects the blended average of everything you have purchased, not just the most recent purchase.
The WAC Formula
When stock is received on a purchase order, AccuArk calculates the new WAC using this formula:
New WAC = ((Existing Quantity x Existing Cost) + (Received Quantity x New Cost)) / (Existing Quantity + Received Quantity)Worked Example
Suppose you have 100 units of an item at a current cost of $10.00, and you receive 50 more units at $12.00 each:
Weighted Old Value = 100 x $10.00 = $1,000.00
Weighted New Value = 50 x $12.00 = $600.00
New Total Stock = 100 + 50 = 150
New WAC = ($1,000.00 + $600.00) / 150 = $10.67After receiving, the item's cost is updated to $10.67 in the database.
Edge Case: Zero or Negative Existing Stock
If the existing total stock is zero or negative (e.g., due to overselling with Allow Orders Exceeding Stock enabled), the new WAC is simply set to the new purchase cost. There is nothing to average against.
When WAC Runs
WAC recalculation happens specifically during Purchase Order receiving. When you enter received quantities on a PO and save:
- AccuArk reads the current total stock across all locations for the item
- AccuArk reads the current cost from the item record (using a row lock)
- The WAC formula is applied
- The item's master cost field is updated with the new WAC
- The location-level stock record's last_cost is updated with the new purchase cost
WAC does not recalculate during:
- Stock adjustments (unless the "Update Item Current Cost" option is specifically checked)
- Stock transfers/moves
- POS sales or returns
- Assembly builds or disassembly
Transaction Safety: SELECT FOR UPDATE
WAC recalculation uses a database-level row lock to prevent race conditions when multiple users receive stock on POs simultaneously.
The process works as follows:
- A database transaction is started
- The current item cost is read using
SELECT cost FROM inventory_item WHERE id = @itemId FOR UPDATE— this locks the row so no other transaction can modify it until the current transaction completes - The total quantity across all locations is read
- The new WAC is calculated
- The item cost is updated
- The transaction is committed, releasing the lock
This ensures that if two employees are receiving POs for the same item at the same time, the WAC calculations do not interfere with each other. The second transaction waits for the first to complete before reading the cost.
Manual Cost Override: Update Item Current Cost
On the Purchase Order form, there is a checkbox labeled Update Item Current Cost. When checked:
- WAC calculation is skipped
- The item's cost is set directly to the purchase cost on the PO line item
- This is a manual override that replaces the cost rather than averaging it
Use this sparingly. The WAC calculation exists to smooth out cost fluctuations across purchases. Manually overriding cost should only be done when:
- You are correcting a known cost error
- The item is being purchased for the first time and you want to set a specific cost
- The existing cost data is unreliable and needs to be reset
How Cost Flows Through the System
Understanding the cost chain helps you troubleshoot pricing and margin issues:
- PO Receiving — A purchase order is received with items at specific costs per unit
- UOM Conversion — If the item has a Purchase Conversion Factor (e.g., 12 units per case), the received base units = entered qty x conversion factor, and the cost is divided accordingly
- WAC Calculation — Unless manual override is checked, the WAC formula runs and updates the item's master cost
- Item Cost Updated — The
costfield oninventory_itemis set to the new WAC - Location Cost Updated — The
last_costoninventory_stock_locationis set to the actual purchase cost (not the WAC) - Markup and Profit Recalculate — The item form's Pricing tab shows updated markup and profit calculations based on the new cost
Markup and Profit Formulas
These formulas use the current cost (which reflects the latest WAC):
| Metric | Formula |
|---|---|
| % Markup | ((Price - Cost) / Cost) x 100 |
| $ Markup | Price - Cost |
| % Profit | ((Price - Cost) / Price) x 100 |
| $ Profit | Price - Cost |
Assembly Cost Variance Detection
For Assembly items, AccuArk's Stock Quantities Report automatically compares the item's saved cost (WAC) against the calculated sum of component costs. If the variance exceeds $0.01:
- The item name is displayed in red
- A tooltip shows "Cost Variance! WAC: $X.XX | Components: $Y.YY"
This helps you detect when assembly costs drift from reality, which can happen when component costs change via WAC but the assembly's own cost has not been recalculated.
Tips
- Let WAC auto-calculate on PO receiving — The automatic calculation produces the most accurate cost over time. Only use manual override when you have a specific reason.
- Monitor cost after large purchases — A significantly higher or lower purchase cost will shift the WAC. Review markup and profit after major PO receipts to ensure prices are still appropriate.
- Check assembly cost variances regularly — Use the Stock Quantities Report to spot assemblies where the saved cost has drifted from the calculated component cost
- Understand the difference between item cost and location last_cost — The item's master cost is the WAC (blended average). The location's last_cost is the actual cost from the most recent purchase at that location. Reports may use either depending on context.