cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dan_yoxall Regular Visitor
Regular Visitor

Calculated column vs measure

Hi 

 

Referring to the below table, the column [Predicted Cost] is based upon the following measure:

       Predicted Cost = SUM('Programme Resource Planning'[Hours]) * SUM('Programme Resource Planning'[Cost]) * 2.11

 

The column [Column] is based upon the following calculated column:

      Column = 'Programme Resource Planning'[Hours] * 'Programme Resource Planning'[Cost] * 2.11

 

Why am I getting different values?

 

Capture.PNG

3 ACCEPTED SOLUTIONS

Accepted Solutions
scottsen Senior Member
Senior Member

Re: Calculated column vs measure

Predicted Cost = SUM('Programme Resource Planning'[Hours]) * SUM('Programme Resource Planning'[Cost]) * 2.11

 

Since the above only works 1 line at a time, you need to use a SUMX.

 

Predicted Cost = SUMX('Programme Resource Planning', CALCULATE('Programme Resource Planning'[Hours] * 'Programme Resource Planning'[Cost]) * 2.11)

 

 

View solution in original post

mattbrice Senior Member
Senior Member

Re: Calculated column vs measure

To answer your question of "Why am I getting different values?".  The answer is in the way Dax calcuated your measure.  For the respective week of year, it first SUMs up all the 'Hours', then summed up all the 'Cost' values and then multiplied the two numbers together, then muliplied by 2.11.    

 

You can't aggregate unit of measure and cost, then multiply.  You have to multiply hours * cost on a line item basis, then aggregate up all the results. 

View solution in original post

dan_yoxall Regular Visitor
Regular Visitor

Re: Calculated column vs measure

Thanks.  I realised i needed to use the iterator SUMX in my measure.  This gave the correct solution.

 

Cost Forecast = SUMX( 'Programme Resource Planning', 'Programme Resource Planning'[Hours] * 'Programme Resource Planning'[Cost]) * 2.11

View solution in original post

5 REPLIES 5
dan_yoxall Regular Visitor
Regular Visitor

Re: Calculated column vs measure

Sorry, I probably should have asked "how do I turn the calculated column into a measure"

vanessafvg Super Contributor
Super Contributor

Re: Calculated column vs measure

when you drop new measure down you choose between column or measure.  in order to change from column to measure you need to paste the calculation into a new measure, in a measure you need to apply aggregate functions as in your first calulation below.

 

why its throwing an error is very difficult to know without seeing your base data 


Did I answer your question? Mark my post as a solution.
Proud a to be a Datanaut!
scottsen Senior Member
Senior Member

Re: Calculated column vs measure

Predicted Cost = SUM('Programme Resource Planning'[Hours]) * SUM('Programme Resource Planning'[Cost]) * 2.11

 

Since the above only works 1 line at a time, you need to use a SUMX.

 

Predicted Cost = SUMX('Programme Resource Planning', CALCULATE('Programme Resource Planning'[Hours] * 'Programme Resource Planning'[Cost]) * 2.11)

 

 

View solution in original post

mattbrice Senior Member
Senior Member

Re: Calculated column vs measure

To answer your question of "Why am I getting different values?".  The answer is in the way Dax calcuated your measure.  For the respective week of year, it first SUMs up all the 'Hours', then summed up all the 'Cost' values and then multiplied the two numbers together, then muliplied by 2.11.    

 

You can't aggregate unit of measure and cost, then multiply.  You have to multiply hours * cost on a line item basis, then aggregate up all the results. 

View solution in original post

dan_yoxall Regular Visitor
Regular Visitor

Re: Calculated column vs measure

Thanks.  I realised i needed to use the iterator SUMX in my measure.  This gave the correct solution.

 

Cost Forecast = SUMX( 'Programme Resource Planning', 'Programme Resource Planning'[Hours] * 'Programme Resource Planning'[Cost]) * 2.11

View solution in original post

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (2,974)