Table Dimension - IF and contains

Hi everyone! I want to create a table dimnesion yes/no. Yes if the name contains “TOSTAO” and no otherwise. It sounds really easy but I haven’t found the answer.

IF (name =%TOSTAO%, yes, no)??

Thank you!

0 2 13.7K
2 REPLIES 2

Hello Silvana,

You’ll find a list of all the string functions here:

Looker Functions and Operators

Overview of functions and operators used in Looker expressions.

For your problem, there are different ways to achieve this but the easiest would be to simply use the contains() function. Remember that in functions when you refer to a field you need to use the use the ${view_name.field} format, which you get through autocomplete.

contains(${view_name.field},"TOSTAO")

If your IF is in SQL then you just make sure it returns boolean. Then the type: yesno will automatically convert boolean values to human-readable Yes and No

Top Labels in this Space
Top Solution Authors