can someone please check if my theoretical understanding of variables is correct?
Suppose that I have a table with 2 columns, Condition1 and Condition2. I want to count the rows for which Condition1 = 4, and Condition2 = Black.
Soppose then that I write a measure called Black, that creates a Table where all rows have Condition2 = "Black". For Example:
Black:= FILTER (Table, Condition2 = "Black")
And then I write the combined code using variables:
Black4_version1 =
var B = [Black]
return = CALCULATE(
COUNTROWS(B),
Condition1 = 4)
Then this code will not work because DAX thinks that the variable B is a single number (because it's calling a measure and measure is by default seen as a single value?), even though I have created a measure that should have created a table.
But if I create the table within a variable itself, then DAX will know that it's a table and then it will work?
Black4_Version2 =
var B = FILTER (Table, Condition2 = "Black")
return = CALCULATE(
COUNTROWS(B),
Condition1 = 4)
I'm asking this because I want to be 100% sure that I have understood the answer given here: DAX: please explain why this measure with a variable will not work also because I have been using variables already at work, so I will need to re-check all the dashboards that I have built and talk to my manager about screwing up a big time. So you could say that my job depends on this.