ABCDEFGHIJ
1
2
Quick CASE for GDS
3
FIELD TO MATCHELSETo copy the below, click INTO the cell and copy the contents rather than copy the cell itself.

This avoids quote marks being added around your CASE statement.
4
QueryOther"
5
6
MATCH TO (SEPARATE BY | )
LABEL
CASE
7
1youtube|you tubeYouTubeCASE
WHEN REGEXP_MATCH(Query, '.*youtube.*|.*you tube.*') THEN 'YouTube'
WHEN REGEXP_MATCH(Query, '.*shirt.*|.*hood.*') THEN 'Tops'
WHEN REGEXP_MATCH(Query, '.*sunglass.*|.*hat .*|.* cap.*') THEN 'Head'
WHEN REGEXP_MATCH(Query, '.*bike.*') THEN 'Wheels'
WHEN REGEXP_MATCH(Query, '.*bottle.*|.*backpack.*|.*bag .*') THEN 'Extras'
ELSE "Other"
END
WHEN REGEXP_MATCH(Query, '.*youtube.*|.*you tube.*') THEN 'YouTube'
8
2shirt|hoodTops
WHEN REGEXP_MATCH(Query, '.*shirt.*|.*hood.*') THEN 'Tops'
9
3sunglass|hat | capHead
WHEN REGEXP_MATCH(Query, '.*sunglass.*|.*hat .*|.* cap.*') THEN 'Head'
10
4bikeWheels
WHEN REGEXP_MATCH(Query, '.*bike.*') THEN 'Wheels'
11
5bottle|backpack|bag Extras
WHEN REGEXP_MATCH(Query, '.*bottle.*|.*backpack.*|.*bag .*') THEN 'Extras'
12
6
13
7
14
8
15
9
16
10
17
ELSE "Other"
18
END
19
20
Made by @hannahrampton
CASE
WHEN REGEXP_MATCH(Query, '.*youtube.*|.*you tube.*') THEN 'YouTube'
WHEN REGEXP_MATCH(Query, '.*shirt.*|.*hood.*') THEN 'Tops'
WHEN REGEXP_MATCH(Query, '.*sunglass.*|.*hat .*|.* cap.*') THEN 'Head'
WHEN REGEXP_MATCH(Query, '.*bike.*') THEN 'Wheels'
WHEN REGEXP_MATCH(Query, '.*bottle.*|.*backpack.*|.*bag .*') THEN 'Extras'
ELSE "Other"
END
21
Released to support 'Data Studio UI - CASE and Treemap filters'
22