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.
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())
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
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |