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

SWITCH and boolean doesn't work as expected? Why not?

Hi Everyone

 

I am trying to use a switch statement to include a column for team location, based on a team identifier integer.

 

Team Location = SWITCH(TRUE(),'Team Map'[Team Order]= 1||2||3||4,"London")

 

However my results are as follows:

 

GC_4002_0-1594813585982.png

 

I have ensured the format of [Team Order] is whole number. the boolean should return FALSE for any number not 1 - 4 so how come I am getting this result?

 

thanks

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Use the IN function

 

Team Location = SWITCH(TRUE(),'Table (2)'[Column1] IN {1,2,3,4},"London")

 

If you are satisfied with my answer, please mark it as a solution so others can easily find it.

Don't forget to give KUDOS ? to replies that help answer your questions


Subscribe to ExcelFort: Learn Power BI, Power Query and Excel

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

Please try an expression like this instead

 

 

Team Location = SWITCH(TRUE(),'Team Map'[Team Order] in {1,2,3,4},"London")

 

 

You could also consider a Groups column if you have other Cities to assign to numbers.  

https://exceleratorbi.com.au/grouping-in-power-bi-desktop-without-using-dax/

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Fowmy
Super User
Super User

@Anonymous 

Use the IN function

 

Team Location = SWITCH(TRUE(),'Table (2)'[Column1] IN {1,2,3,4},"London")

 

If you are satisfied with my answer, please mark it as a solution so others can easily find it.

Don't forget to give KUDOS ? to replies that help answer your questions


Subscribe to ExcelFort: Learn Power BI, Power Query and Excel

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

you beauty. thanks that works great! solution accepted and kudos given

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