Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

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!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

If([column2] ="A" && [column3] ="3",1,0)

 

switch(true(),

[column2] ="A" && [column3] ="3",1

,0)

For Or Use ||

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.
Table:

c1.png

 

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.

c2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Tahreem24
Super User
Super User

@Anonymous ,

Try the below Code:

Column = IF('Table'[Column1]="A" && 'Table'[Column2]="E","YES","NO")

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
amitchandak
Super User
Super User

@Anonymous ,

If([column2] ="A" && [column3] ="3",1,0)

 

switch(true(),

[column2] ="A" && [column3] ="3",1

,0)

For Or Use ||

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
ryan_mayu
Super User
Super User

@Anonymous 

 

I think it works

Column = SWITCH(TRUE(),'Table'[Column1]="A" && 'Table'[Column2]="E","yes")

1.PNG

Then I did a test to change a to b, the result is blank.

2.PNG

hope this is helpful.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors