What cost of goods sold is measuring
Cost of goods sold, or COGS, represents the inventory cost assigned to the goods sold during the period. It is not the same as total purchases. First, a business combines opening inventory and purchases to find the cost of goods available for sale. Then it removes the ending inventory that remains unsold. The remainder is cost of goods sold.
This matters because gross profit is based on revenue minus cost of goods sold, not revenue minus purchases alone. A business can buy heavily in one period and sell those goods in another, so inventory timing has to be handled correctly before margin analysis is meaningful.