Power BI measures vs calculated columns: choose row values or filter aware calculations
Calculated columns produce a value for each row and store it in the model; measures calculate on demand in the current filter context. Use a column for a row attribute that must be grouped, sorted, related, or selected in a slicer. Prefer a measure for totals, averages, and ratios that should respond to report filters.
Power BI measures vs calculated columns: choose row values or filter aware calculations
Calculated columns produce a value for each row and store it in the model; measures calculate on demand in the current filter context. Use a column for a row attribute that must be grouped, sorted, related, or selected in a slicer. Prefer a measure for totals, averages, and ratios that should respond to report filters.
How they differ
A calculated column is evaluated row by row during model processing or refresh. Its values are stored, so it can increase model size and refresh work. A measure is evaluated when a visual requests it; slicers, filters, rows, columns, and relationships shape its filter context. A row context means the current row being evaluated; filter context is the set of rows currently included in the calculation. Storage and materialization details can depend on the model's storage mode.
Example: why total margin is not the average row margin
These are illustrative sales rows, not actual business results:
| Product | Qty | Unit price | Unit cost | Sales | Cost | Margin |
|---|---|---|---|---|---|---|
| A | 2 | 50 | 30 | 100 | 60 | 40% |
| B | 1 | 100 | 70 | 100 | 70 | 30% |
| C | 3 | 20 | 12 | 60 | 36 | 40% |
| Total | 6 | 260 | 166 |
Row sales and costs can be calculated as columns:
Line Sales = Sales[Quantity] * Sales[Unit Price]
Line Cost = Sales[Quantity] * Sales[Unit Cost]For an overall margin, divide total profit by total sales. The simple average of row margins is 36.67%, while the correctly weighted total is (260 - 166) / 260 = 36.15%.
Sales Amount = SUM(Sales[Line Sales])
Gross Profit = [Sales Amount] - SUM(Sales[Line Cost])
Gross Margin % = DIVIDE([Gross Profit], [Sales Amount])DIVIDE returns BLANK when the denominator is zero unless you provide an alternate result. In a product table, the measure follows each product's filter; the total is recalculated for all included sales rather than averaging displayed percentages.
Choose and verify
Choose a calculated column when the result is a stable row category, label, key, or sort value used on an axis, legend, slicer, or relationship. Choose a measure when the answer should change with date, product, or region filters. Before adding a column, consider model size, refresh cost, and whether the source or Power Query can do the transformation. Measures are generally used as visual values or visual-level filters, not as new slicer categories.
In Power BI Desktop, a measure can be created from Report, Table, or Model view; Modeling > New measure is one documented route (labels can vary by version). Verify the three row sales add to 260, total profit is 94, and the total margin is 94/260 = 36.15%. Change a product or date filter and confirm the measure recalculates. Decide whether a zero denominator should remain blank or use an explicit alternate result.
Sources
[Calculation options in Power BI Desktop](https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-calculations-options)
[Create calculated columns in Power BI Desktop](https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-calculated-columns)
[Create measures for data analysis in Power BI Desktop](https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-measures)
[DAX glossary](https://learn.microsoft.com/en-us/dax/dax-glossary)
[DAX overview](https://learn.microsoft.com/en-us/dax/dax-overview)
[DIVIDE function](https://learn.microsoft.com/en-us/dax/divide-function-dax)