What is the difference between a calculated column and a measure in Power BI?

A calculated column and a measure both use DAX (Data Analysis Expressions) for calculations in Power BI, but they differ in how they operate and are used:

  1. Calculated Column:
    • Definition: A calculated column is created by adding a new column to a table using a DAX formula.
    • Storage: Values are computed row by row and stored in the data model, increasing the model size.
    • Use Case: Used when you need to calculate values for each row in a table. For example, creating a “Profit” column from “Sales” and “Cost” columns: Profit = Sales[Amount] - Sales[Cost]
    • Scope: Works at the row level.
  2. Measure:
    • Definition: A measure is a dynamic calculation performed on the data when it’s used in a visual, based on the filter context.
    • Storage: Measures are not stored in the data model; they are computed on demand.
    • Use Case: Used for aggregations or calculations across multiple rows. For example, calculating total sales: Total Sales = SUM(Sales[Amount])
    • Scope: Works at the aggregation level and is context-sensitive (responds to slicers and filters in the report).

Key Difference:

  • Calculated columns are static and tied to individual rows, whereas measures are dynamic and depend on the filter or aggregation context of the report.