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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bigman24
Frequent Visitor

SEARCH Function To Flag Products

I am trying to do a calculated column with using a search function.  I have tried using two different methods and I get errors with each.  Essentially I am trying to find test in the Product Name column and assin it a 1 to later filter out the 1's for a listing prodcuts I want to include in a calculation.  Here are the two ways I went about doing it:

 

=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]), 1,0)

 

And this way I thought I was getting fancy:

 

= 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())

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @bigman24 ,

Have you solved your problem?

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please share your data sample and your desired output so that I could have a  test on it.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @bigman24 ,

It seems that there is no syntax error for both of the formulas.

What error message do you get?

If it is convenient, could you share your data sample which could reproduce your scenario and your desired output so that we could help further on it.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.