Using the create custom dimension field in Looker (screenshot below) I want to group rows into one label. For example:
Campaign Name
Row 1: UK_oxfordstreet
Row2: UK_uxbridge
Row3: UK_clapham
Can I create a new dimension with a rule saying if Campaign Name contains “oxfordstreet” OR “uxbridge” OR “clapham” label as “London” ?
FYI I don’t have access to the data warehouse, I am not a developer, analyst - I do not know SQL. I am looking for a simple solution to this within the Looker interface explore area.
you should be able to do something like:
if(contains(string_to_search, "oxfordstreet") OR contains(string_to_search, "uxbridge") OR contains(string_to_search, "clapham"),"London","")
Thank you! This looks like it’s working perfectly.
@Shekiaya if I want to create multiple labels in the same dimension how do I do this? For example:
Row 1: UK_oxfordstreet
Row2: UK_uxbridge
Row3: UK_clapham
Row4: UK_kirkby
Row5: UK_seaforth
Campaign Name contains “oxfordstreet” OR “uxbridge” OR “clapham” label as “London”
Campaign Name contains “kirkby” OR “seaforth” label as “Liverpool”
I want the same dimension for both “London” and “Liverpool”
There may be a more elegant way to do it, but replacing “” with another if clause should work:
if(contains(string_to_search, "oxfordstreet") OR contains(string_to_search, "uxbridge") OR contains(string_to_search, "clapham"),"London", if(contains(string_to_search, "kirkby”) OR contains(string_to_search, "seaforth”),"Liverpool",""))
I got it working this way:
if(contains(${utms.campaign}, “ios”) ,“IOS”,if(contains(${utms.campaign}, “and”) ,“Android”,""))