Forum Discussion
Can I use AND/OR fields in SWITCH?
Hello
I have the table:
1, A, E
2, B, F
I want to specify a value, when Column2=A and Column3=E.
Can I do that with SWITCH or do I need IF?
Thanks!
Anonymous ,
If([column2] ="A" && [column3] ="3",1,0)
switch(true(),
[column2] ="A" && [column3] ="3",1
,0)
For Or Use ||
4 Replies
- ryan_mayu
Super User
Anonymous
I think it works
Column = SWITCH(TRUE(),'Table'[Column1]="A" && 'Table'[Column2]="E","yes")Then I did a test to change a to b, the result is blank.
hope this is helpful.
- amitchandak
Super User
Anonymous ,
If([column2] ="A" && [column3] ="3",1,0)
switch(true(),
[column2] ="A" && [column3] ="3",1
,0)
For Or Use ||
- Tahreem24
Super User
Anonymous ,
Try the below Code:
Column = IF('Table'[Column1]="A" && 'Table'[Column2]="E","YES","NO") - v-alq-msft
Community Support
Hi, Anonymous
Based on your description, I created data to reproduce your scenario.
Table:You may create a measure as below to control the display of the visual.
Visual Control = IF( SELECTEDVALUE('Table'[Column2])="A"&& SELECTEDVALUE('Table'[Column3])="E", 1,0 )Then you need to put the measure in the corresponding visual level filter to get the result.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.