DAX Power BI: CALCULATE — Changing Context
Consider the task of adding a Total column for each customer for the Orders table
First, we use the SUM function and create a column. As a result, we get the sum of all columns
Our task is to make each line display only the amount that applies to a particular client. To do this, we will use the CALCULATE function. But when we use this function, we will see that the values are not counted correctly.
To fix this, let’s add the ALL function to our code to remove filters. But since there are so many columns in this table, it’s easier to use the ALLEXCEPT function — this function removes all filters except the specified column
To check if the calculation is correct, we can use the SUMMARIZE function