Cost of Goods Sold (COGS)

Cost of goods sold is the direct cost of producing the goods or services a company sells, and it sits at the center of gross profit and margin reporting.

What is cost of goods sold (COGS)?

Cost of goods sold is the direct cost of producing the goods or services a company sold during a period. It includes raw materials, direct labor, and the manufacturing or delivery costs tied to each unit, but not the indirect costs of running the business such as sales, marketing, or administration. Because it captures only direct cost, COGS is the figure that turns revenue into gross profit, and it anchors how a finance team reads product profitability.

For manufacturers, distributors, and construction firms, COGS is rarely a single number. It is assembled from material, labor, freight, and overhead costs that live across different ERP modules, which is why two reports can show different COGS for the same product when the underlying mapping is inconsistent.

How to calculate cost of goods sold

The standard formula works from inventory:

COGS = Beginning Inventory + Purchases – Ending Inventory

Worked example:

  • Beginning inventory: $1,200,000
  • Purchases during the period: $3,000,000
  • Ending inventory: $1,000,000
  • COGS: 1,200,000 + 3,000,000 – 1,000,000 = $3,200,000

Once COGS is known, gross profit is revenue minus COGS, and gross margin is that result divided by revenue.

COGS in Power BI (DAX)

The exact measure depends on your data model. The pattern below is generic; replace the table and column names with the ones in your model. When cost sits on each transaction line, a simple sum works:

Total COGS = SUM ( Sales[COGS Amount] )

-- When cost is unit cost x quantity on each line:
Total COGS =
SUMX (
    Sales,
    Sales[Quantity] * RELATED ( Product[Unit Cost] )
)

Gross Profit = [Total Revenue] - [Total COGS]

SUMX evaluates cost row by row, which matters when unit cost varies by product. RELATED pulls the unit cost from a related product table.

What counts as a good COGS?

COGS is not judged on its own. It is read as a share of revenue, where a lower ratio leaves more gross profit. What counts as healthy depends entirely on the industry: a software company carries very low COGS, while a distributor or manufacturer carries a high one because materials and labor dominate the cost of each sale. The signal worth watching is the direction over time. A COGS ratio creeping up usually means input costs are rising faster than prices.

COGS vs operating expenses

COGS covers only the direct cost of what was sold. Operating expenses cover the indirect cost of running the company: sales, marketing, rent, and administration. The line between them matters because moving a cost from one bucket to the other changes gross profit without changing net profit. Consistent classification is what keeps margin reporting trustworthy.

Common COGS reporting pitfalls

COGS goes wrong when cost is allocated inconsistently across products, when freight or overhead is included in one report and excluded in another, or when each system applies its own costing method. In environments with more than one ERP, the same item can carry a different cost in each, so a consolidated COGS figure is only as reliable as the mapping that brings those sources together.

Reporting COGS from your ERP data

COGS draws on inventory, purchasing, and production data that often lives in separate modules or separate systems. When those sources are not reconciled, gross margin reporting drifts. A governed data foundation maps material, labor, and overhead costs to each product once, so margin reads the same number in every report. QuickLaunch ships pre-built models for JD Edwards, Vista, NetSuite, and OneStream that surface COGS and gross margin from source data without rebuilding the logic by hand.

Frequently Asked Questions

How is cost of goods sold calculated?

Add beginning inventory to purchases, then subtract ending inventory. A company that starts with $1.2M in inventory, buys $3M, and ends with $1M has $3.2M in COGS.

What is the difference between COGS and operating expenses?

COGS is the direct cost of producing what was sold. Operating expenses are the indirect costs of running the business, such as sales, marketing, and administration.

Is COGS the same as cost of sales?

They are used interchangeably in most reporting. Service companies often label the figure cost of sales, while companies that hold inventory tend to use cost of goods sold.

Related QuickLaunch Solutions and Products

Foundation Pack

Accelerate time to insight while lowering total cost of ownership by creating a unified and centralized business foundation with your CRM, ERP, and other data sources.

Key Features

  • Automated Data Pipelines & Replication
  • Modern Data Lakehouse Architecture
  • Pre-Built, Enterprise-Grade Data Models
  • Advanced Analytics Capabilities
Learn More About NetSuite Analytics

JDE Pack

Unlock finance, supply chain, manufacturing, job cost, and payroll insights from EnterpriseOne with pre-built ERP analytics.

Key Features

  • 29 perspectives
  • 3,000+ measures
  • 200+ relationships
  • Automatic Julian date conversion
  • User-defined code translation 
Learn More About JD Edwards Analytics

Vista Pack

Purpose-built analytics for construction project intelligence, job costing, and operational performance.

Key Features

  • 11 perspectives
  • 1900+ measures
  • Specialized job costing
  • Earned revenue calculations 
  • WIP & retention tracking 
Learn More About Vista Analytics

NetSuite Pack

Gain clarity on core financials (GL, AP, AR) with streamlined multi-calendar financial reporting and cloud ERP analytics.

Key Features

  • 3 perspectives
  • 600+ measures
  • 40+ relationships
  • Multi-subsidiary consolidation 
  • SuiteAnalytics integration 
Learn More About NetSuite Analytics

OneStream Pack

Financial planning, reporting, and consolidation analytics integrated with OneStream's Partner Place marketplace. 

Key Features

  • 500+ dimensions
  • 900+ measures
  • 25+ relationships
  • FP&A integration
  • Consolidation workflows
Learn More About OneStream Analytics

Get Your Custom Analytics Blueprint

Let us show you exactly how our unified platform can meet your specific goals in a personalized live demo.

Get Custom Demo