简体   繁体   中英

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 !!

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM