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

Response Needed: Data Studio: Regular Expressions to Filter by strings within campaign name

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We want to create a dimension in Data Studio called Creative Name by extracting a piece of a the Campaign Name string.

For example, if we have the following Campaign Names:

"Red_Campaign1_June_Display"

"Red_Campaign2_June_Display"

"Blue_Campaign1_June_Display"

"Blue_Campaign2_June_Display"

 

And, we want to use these Campaign Names to create the Dimension "Creative Name" with the following values:

"Red"

"Blue"

 

What would be the best way to accomplish this?

 

These campaign names will continue change and grow in volume so we want to use a formula that will be easily generalizable to new Campaign Values. For instance, if next month we add "Red_Campaign3_July_Display", we want it to immediately recognize it as Creative Name: "Red"

 

We have tried the below formulas. Can you explain if this is the best approach? If not, can you provide the correct formulas? Lastly, we have wondered if using REGEXP_EXTRACT would be the better approach. Can you provide your recommendation for which approach is best?

 

CASE WHEN REGEXP_MATCH (Campaign, "Red.*”) THEN "Red" WHEN REGEXP_MATCH (Campaign, “Blue.*”) THEN “Blue” ELSE “Other” END