When you define a variable with VAR
, that value is treated as a constant when referenced later.
Therefore, in your first measure, var2
is the same as var1
since a constant is not changed by adjusting the filter context with CALCULATE.
If instead of defining a temporary variable, you defined var1
as a separate measure, then it would function as you expected it to in your first example.
As a side note, you can use multiple conditions rather than nesting CALCULATE functions:
measure3 =
CALCULATE (
[measure],
table[column_1] = "some value in column 1",
table[column_2] = "some value in column 2"
)
CLICK HERE to find out more related problems solutions.