Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
brs09j
Helper II
Helper II

How does a measure replace a calculated column here?

They say best practice is to always use a measure when you can. Lets say I have a calculated column that is

 

Calculated Column = Sales [Unit Price] * Sales [Quantity]

 

Measure = SUMX (Sales, Sales [Unit Price] * Sales [Quantity] )

 

 

So a calculated column will evaluate the formula and give you an individual answer for each new row in the new column.

 

The measure will evaluate the formula as well but will just sum up all of the results at the end to give you one answer.

 

How are these alike? Is this only for visualizations? Does this have to do with the default summarization feature? Let me know what I'm missing here.

 

Thanks.

1 ACCEPTED SOLUTION
GilbertQ
Super User
Super User

Hi @brs09j

 

The reason for using measures is that due to all the data being stored in memory, when you use a measure it will not have to iterate over each and every row to complete the calculation. Or literally go through each row one at a time. So that is how it can perform things so quickly and easily.

 

In terms of your example a SUMX will still iterate over each and every row based on what a SUMX function is designed to do.

 

You would be better off creating a measure which would be:

 

Measure = sum('Sales'[Unit Price]) * sum('Sales'[Quantity])

This will give you the same result, but a lot quicker. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

View solution in original post

1 REPLY 1
GilbertQ
Super User
Super User

Hi @brs09j

 

The reason for using measures is that due to all the data being stored in memory, when you use a measure it will not have to iterate over each and every row to complete the calculation. Or literally go through each row one at a time. So that is how it can perform things so quickly and easily.

 

In terms of your example a SUMX will still iterate over each and every row based on what a SUMX function is designed to do.

 

You would be better off creating a measure which would be:

 

Measure = sum('Sales'[Unit Price]) * sum('Sales'[Quantity])

This will give you the same result, but a lot quicker. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.