AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Data Studio
3.1K members online now
3.1K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

CASE WHEN with 2 conditions

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi!!

I'm using the function to create NEW DIMENSIONS in order to organize my Paid campaigns into 4 groups (Brand, Non-Brand, Shopping and Display)

Here is the query: 

 

CASE

WHEN REGEXP_MATCH(Campaign, ".*(NAME_CAMPAIGN_1).*") THEN "1"

WHEN REGEXP_MATCH(Campaign, ".*(NAME_CAMPAIGN_2).*") THEN "2"

ELSE "3"

END

I need to include a double condition in every "WHEN" so that I can express: When campaign is XXX & default channel grouping is Paid / Display, THEN...

 

Otherwise my "NON-BRAND" group would include campaings from other channels. 

 

I know I can use a filter (channel grouping = paid / display) later, but I'd prefer to do it in my query if its posible. 

Do you know how to write it?

I tried this, but it does not work: 

 

CASE

WHEN REGEXP_MATCH(Campaign, ".*(NAME_CAMPAIGN_1).*") AND REGEXT_MATCH (Adquisition Channel, ".*(PAID).*")THEN "1"

WHEN REGEXP_MATCH(Campaign, ".*(NAME_CAMPAIGN_2).*") THEN "2"

ELSE "3"

END