top of page

The Key Differences between a Measure and a Calculated Column in Power BI

  • Jan 19, 2024
  • 3 min read

Updated: Jan 24

In the world of Power BI, measures and calculated columns are important concepts that are often misunderstood and can cause confusion in the report development process.


Early on in my Power BI journey I tried to create a measure for a particular use case and then realised the item I wanted to use in my calculation was not available and I couldn't understand why. I am sure many of us have come across this scenario which can cause frustration at the best of times.


Another issue that pops up during the development process is whether to use a measure or calculated column to address a specific problem. It is easy to get confused between these two concepts as there are cases when either one can provide you the result you are looking for.


In this article I am going to highlight the key differences between the two and provide some practical examples that will help you decide which one to use based on the specific use case.



What is a measure?


In Power BI a measure is used to calculate aggregates such as sum, average, counts and is calculated on the fly, adapting to filters and slicers applied in reports.


Measures are defined using DAX and values are computed only when needed for visualisations or calculations and are not stored within the model.


An example of a measure is calculating the total sales for a given period based on a specific column.


Sales

When to use a measure:

  • When performing aggregations.

  • When you need dynamic calculations that respond to user interactions.

  • When calculations need to take the filter context into account.



What is a calculated column?


A calculated column is a column that is added to a table in the data model, and the calculation is performed on each row of the table and forms part of the underlying dataset.


Calculated columns are not affected by slicers or filters and are used to create new attributes and perform calculations that do not require any dynamic aggregations.


An example of a calculated column is calculating the profit made on each item sold.


Calculated Column

When to use a calculated column:

  • When you need to create new attributes or categories at the row level.

  • When calculations are independent of filters or slicers.

  • When performance is critical for large datasets.



Key Differences


The table below outlines the key differences between a measure and a calculated column:


Measure

Calculated Column

Storage

Values not stored in Data Model

Values are stored in Data Model

Resources

Uses CPU

Uses Memory

Evaluation

Calculated at query time

Calculated when created/refreshed

Filter Context

Affected by filters and slicers

Not affected by filters and slicers

Usability

Can be used in multiple visuals/reports

Bound to a specific table

Performance

Best for aggregations

Best for row by row evaluation

Use Cases

Aggregations such as sum, average etc.

Categorisation/row level calculations


Use Cases


Below are some use cases that will help you decide when it is best to use a measure or a calculated column:


Use Case 1:


You have a sales report and need to calculate a running total for the sales year to date. The running total must be dynamic and change when filters and slicers are applied to the visual.


Solution: In this case you need to use a measure as we need an aggregated value that is dynamic and responds to user input.


Use Case 2:


You have a customer analytics report and you need to categorize customers into segments based on their total purchase history.


Solution: In this case you need to use a calculated column as we need to perform row by row evaluation.


Use Case 3:


You have a sales report that contains a date field in the form YYYY-MM-DD. You want to add an attribute to the x-axis of a bar chart so that you can view the data by year.


Solution: In this case you need to use a calculated column as we need to add an attribute to a visual.



In closing, just remember this:


Measures are dynamic, flexible calculations that adapt to user interactions.

Calculated Columns are static, pre-computed attributes that enhance the data model.


Understanding the differences between measures and calculated columns and their use cases is vital to becoming a successful Power BI developer.


If you enjoyed this article please like, comment and share this post on your social media platforms.


Happy developing!


Comments


bottom of page