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

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:






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




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