Who this is for
Gross margin is a simple ratio resting on a hard judgment call: which costs are direct. Revenue is usually clean, but whether inbound freight, payment fees, packaging, or production labor belong in cost of goods sold changes the margin by whole percentage points, and inconsistent answers make every month incomparable to the last.
Enter revenue and direct costs to get gross profit and gross margin, with operating expenses kept separate for the net view. The guidance below draws the COGS boundary for common business types so the number you calculate this month means the same thing next month.