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

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

Reply
Anonymous
Not applicable

Using SWITCH with IN

Hello Community    -    This is a new thread for the same topic.   Previously I was trying a different formula, but ultimately I think SWITCH might be better as I have two variable that I need to check  (different columns, but same table). 

 

First, I need to check if the Product Code fits a certain criteria.    Second, I need to check if the ITEM description contains (anywhere) the text  "-1".    

 

This formula below only works if I do not include the IN statements.    All I get returned is  "NA".      Just trying to figure out how to include the IN statment, or some other formula that gets to the result below. 

 

The goal would be to return this result, if the row item met the criteria.

 

Product Code          Item                              SKU Type

CODE123            AB-23-45-1-X               Standard SKUs

 

SKU Type =  SWITCH(
TRUE(),
'Flu_Shipped Query'[Product Code] = "CODE123" && 'Flu_Shipped Query'[Item] IN {"-1"}, "Standard SKUs",
'Flu_Shipped Query'[Product Code] = "CODE346" && 'Flu_Shipped Query'[Item] IN {"-1"}, "Standard SKUs",
'Flu_Shipped Query'[Product Code] = "CODE782" && 'Flu_Shipped Query'[Item] IN {"-1"}, "Standard SKUs",
"NA")
1 ACCEPTED SOLUTION
Tahreem24
Super User
Super User

@Anonymous ,

Try to use Search or Find DAX:

SKU Type =  SWITCH(
TRUE(),
'Flu_Shipped Query'[Product Code] = "CODE123" && SEARCH("-1",'Flu_Shipped Query'[Item]),"Standard SKUs",
 . . . )
Please complete your formula like above.
 
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

View solution in original post

4 REPLIES 4
vanessafvg
Super User
Super User

have you checked your data? i have run this on some test data and your code works fine, maybe your data doesn't support your condition?

 

see attached





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Tahreem24
Super User
Super User

@Anonymous ,

Try to use Search or Find DAX:

SKU Type =  SWITCH(
TRUE(),
'Flu_Shipped Query'[Product Code] = "CODE123" && SEARCH("-1",'Flu_Shipped Query'[Item]),"Standard SKUs",
 . . . )
Please complete your formula like above.
 
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
Anonymous
Not applicable

@Tahreem24     Thanks Tahreem, but I am getting the following error: 

 

The search Text provided to function 'SEARCH' could not be found in the given text

@Anonymous ,

There is a simplied version of DAX. I've created same sample like you and also attached the screen shot below with DAX and expected output.

Hope it may help you.

Capture.PNG

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.