Istiak Mahmood
Istiak Mahmood

Reputation: 2422

Switch & Combination DAX/Power BI

I am trying to build a switch statement where -

Table1'[Column A] value need to be exact value for Table1'[Column B], so if on both of the row have the yes value the output should be "Table1Yes".

On the Second condition - if 'Table1'[Column A] & Table2'[Column A] both have Yes value than the output should be "Table2Yes" else the output should be empty.

This is my query-

Both = SWITCH(TRUE();
'Table1'[Column A] & Table1'[Column B]= "Yes"; "Table1Yes";
'Table1'[Column A] = "Yes" & Table2'[Column A]= "Yes";"Table2Yes";"Empty")

But it seems like the & function is not working in the Switch statement, also I am unable to call the Table2'[Column A] from Table 1 although both of the tables are connect to each other.

Anyone knows any solution !!

Upvotes: 0

Views: 644

Answers (1)

Strawberryshrub
Strawberryshrub

Reputation: 3389

In DAX it would be:

Both = SWITCH(TRUE();
              AND('Table1'[Column A] = "Yes"; 
                  'Table1'[Column B] = "Yes"); 
              "Table1Yes";
              AND('Table1'[Column A] = "Yes"; 
                  'Table2'[Column A] = "Yes");
              "Table2Yes";
              "Empty")

Upvotes: 1

Related Questions