Reputation: 1796
I am trying to sum 3 columns. This DAX for a calculated column sums all rows in the dataset rather than summing per row.
Using a measure with the same DAX works, except the total is wrong....
How do I get the correct sum per row and total?
Upvotes: 2
Views: 2679
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.
Upvotes: 2