Ethan Pelton
Ethan Pelton

Reputation: 1796

Sum and total per row for calculated column in Power BI/DAX

I am trying to sum 3 columns. This DAX for a calculated column sums all rows in the dataset rather than summing per row.

Total per row for calculated column

Using a measure with the same DAX works, except the total is wrong....

enter image description here

How do I get the correct sum per row and total?

Upvotes: 2

Views: 2679

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89361

Calculated columns have a row context, but no filter context. If you want to add the current row context into a filter context, wrap your calculated column expression in CALCULATE.

The CALCULATE function used without filters achieves a specific requirement. It transitions row context to filter context. It's required when an expression (not a model measure) that summarizes model data needs to be evaluated in row context. This scenario can happen in a calculated column formula or when an expression in an iterator function is evaluated. Note that when a model measure is used in row context, context transition is automatic.

CALCULATE function (DAX)

Upvotes: 2

Related Questions