Skip to content
Carmel Eve By Carmel Eve Software Engineer I
Learning DAX and Power BI – Calculated Columns and Measures

So, in my previous 2 blogs I went over the theory of filter contexts and row contexts, now it's time for some examples!

Calculated columns

I have already touched on how calculated columns work: They iterate over all of the rows of the table, using the row context to evaluate the formula for the current row.

We saw in our previous example that we could define a new column which indicates whether or not a person has children by going to the table view and clicking "new column".

Showing calculated column in model.

Here we are using an IF statement. The first argument is the condition to be evaluated, the second argument is the value if that condition is TRUE, and the third is the value if it is FALSE.

This expression is re-evaluated for each row every time the data is refreshed, and the values are stored in the model. Therefore each calculated column will mean that the model takes up more disk space. This is fine in our small example, but this can be important to consider as datasets get larger.

Measures

The output of a calculated column is, well, a column. If you instead want to aggregate a column to produce a value, you need to use a measure.

Discover your Power BI Maturity Score by taking our FREE 5 minute quiz.

We have also seen an example of this already, where we calculated the total number of children. If we click "new measure" and enter the following:

Total children measure being calculated.

We have seen that we can display the total number of children as follows:

Displaying number of children displayed in a table.

Displaying 14 total children.

And have seen that measures operate under any filter context which has been applied:

Table filtered to only those in London.

Showing 4 total children.

These values are evaluated every time you query the data (unlike calculated columns which are calculated on data refresh). The formula for evaluating the measure is stored on the model, but the value itself is calculated every time. This means that measures do not cause the model to take up much extra memory, but instead consume CPU.

In general, it is best practice to use measures where possible as DAX is optimized for these operations and in general reports will be memory limited rather than CPU.

So, in summary:

We have calculated columns which are evaluated row by row for a table. The values for each row are added to the model and cause a report to consume more memory.

Power BI Weekly is a collation of the week's top news and articles from the Power BI ecosystem, all presented to you in one, handy newsletter!

We have measures which are used to calculate a single valued aggregation over a column (or multiple columns). The values are not added to the model and using these cause a report to consume more CPU.

There are many different aggregation functions, and I will go into this in more detail in my next blog.

Carmel Eve

Software Engineer I

Carmel Eve

Carmel is a software engineer and LinkedIn Learning instructor. She worked at endjin from 2016 to 2021, focused on delivering cloud-first solutions to a variety of problems. These included highly performant serverless architectures, web applications, reporting and insight pipelines, and data analytics engines. After a three-year career break spent travelling around the world, she rejoined endjin in 2024.

Carmel has written many blog posts covering a huge range of topics, including deconstructing Rx operators, agile estimation and planning and mental well-being and managing remote working.

Carmel has released two courses on LinkedIn Learning - one on the Az-204 exam (developing solutions for Microsoft Azure) and one on Azure Data Lake. She has also spoken at NDC, APISpecs, and SQLBits, covering a range of topics from reactive big-data processing to secure Azure architectures.

She is passionate about diversity and inclusivity in tech. She spent two years as a STEM ambassador in her local community and taking part in a local mentorship scheme. Through this work she hopes to be a part of positive change in the industry.

Carmel won "Apprentice Engineer of the Year" at the Computing Rising Star Awards 2019.