The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I am trying to flag a list of item in a Product Name column using the SEARCH function. I have tried using both an IF Statement as well as a SWITCH function. Essentially I am wanting to flag in a calculated column if a product meets the criteria and then I will use that 1,0 flag in future calculations. Can someone help me with the following formulas?
=If(
SEARCH("*Gift Card*", 'Product'[ProductName])
|| SEARCH("*Play*", 'Product'[ProductName])
|| SEARCH("*Rental*", 'Product'[ProductName])
|| SEARCH("*Refund*",'Product'[ProductName])
|| SEARCH("*Service Fee*", 'Product'[ProductName])
|| SEARCH("*Prior Day*", 'Product'[ProductName])
|| SEARCH("*Activation*", 'Product'[ProductName])
|| SEARCH("*Award*", 'Product'[ProductName])
|| SEARCH("*Booking*", 'Product'[ProductName])
|| SEARCH("*Ticektless*", 'Product'[ProductName])
|| SEARCH("*Lanyard*", 'Product'[ProductName]), 1,0)
This is the switch funtion I tried using:
= SWITCH(
True(),
SEARCH("*Gift Card*", 'Product'[ProductName],,1)
,SEARCH("*Play*", 'Product'[ProductName],,1)
,SEARCH("*Rental*",'Product'[ProductName],,1)
,SEARCH("*Refund*", 'Product'[ProductName],,1)
,SEARCH("*Service Fee*", 'Product'[ProductName],,1)
,SEARCH("*Prior Day*", 'Product'[ProductName],,1)
,SEARCH("*Activation*", 'Product'[ProductName],,1)
,SEARCH("*Award*",'Product'[ProductName],,1)
,SEARCH("*Booking*",'Product'[ProductName],,1)
,SEARCH("*Ticketless*", 'Product'[ProductName],,1), BLANK())
Solved! Go to Solution.
@bigman24 try this
=If( SEARCH("*Gift Card*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Play*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Rental*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Refund*",'Product'[ProductName],,-1)>=0 || SEARCH("*Service Fee*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Prior Day*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Activation*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Award*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Booking*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Ticektless*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Lanyard*", 'Product'[ProductName],,-1)>=0 , 1,0)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@bigman24 try this
=If( SEARCH("*Gift Card*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Play*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Rental*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Refund*",'Product'[ProductName],,-1)>=0 || SEARCH("*Service Fee*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Prior Day*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Activation*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Award*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Booking*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Ticektless*", 'Product'[ProductName],,-1)>=0 || SEARCH("*Lanyard*", 'Product'[ProductName],,-1)>=0 , 1,0)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
That seems to have worked! Thank you very much.