Creating a field where I can group strings containing same word

Hello all,

I am creating a new field on Google Looker Studio called brandName which will contain Brand names, I will use this field to create a filter for my dashboard where a user can select by Brand. There is another field in my data called ‘campaignName’, this has names of campaigns.

The reason I am creating the brandName field is because each campaign name in the campaignName field contains the brand name, and a lot of numbers. For example: “432432Adidas12”, “Nike_324124”

In the brandName, I’d like to group campaigns by brand name. I want to find a way where i can for example say that if a campaign name contains the word “Adidas”, then campaigns “432432Adidas12” and “Adidas_901234” will both fall under “Adidas” in the brand filter.

How can I do this?

I think your formula should look like this

CASE
WHEN REGEXP_MATCH(CampaignFieldHere,“.adidas.”) THEN “Adidas”

WHEN REGEXP_MATCH(CampaignFieldHere,“.nike.”) THEN "Nike"ELSE “Other”
END

You can add additional rows with other brands.

1 Like

You can also use the Group feature for calculated fields (using the Contains option) which will do this without having to write a formula.

https://support.google.com/looker-studio/answer/14258973?hl=en&ref_topic=7570421&sjid=8868092151714092005-NA

1 Like