How to take a single suggestion and filter against multiple values?


(Eric Richmond) #1

I have a situation where we have values in our database that are not clean. I.e.

‘Red’
‘red’
‘RED’

and instead of having a filter that shows all three values, I’d like to just give the dimension a “suggestion” of “Red”.

Then, when the user selected “Red”, I just want to modify my filter, so instead of filtering on just “Red”, I want to filter on something like “IN (‘RED’, ‘Red’, ‘red’)”.

This seems like it should be so easy, but I can’t wrap my head around how to get this working.

Any suggestions would be greatly appreciated.


(Nicholas Wong) #2

You can do so by using SQL CASE Statement. CASE statement goes through conditions and return a value when the first condition is met (like an IF-THEN-ELSE statement). LookML is a developed language of SQL.

CASE
WHEN condition1 THEN result1
WHEN condition2 THEN result2
WHEN conditionN THEN resultN
ELSE result
END;

Hope this helps! :smiley: