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

Calculated Field - Formula Parsing Error

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

 

I have a formula that gets parsing error. I cannot see what is the problem and will request your help,

 

CASE
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(brand).*”) THEN “Brand”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(DR|RMD|Dynamic Remarketing|).*”) THEN “Retargeting”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(DSA|Genel).*”) THEN “DSA Genel”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(Marka).*”) THEN “Marka”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(Kategori).*”) THEN “Kategori”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(Shopping).*”) THEN “Shopping”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(CRM|RLSA).*”) THEN “CRM RLSA”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(Generic|jenerik).*”) THEN “Generic”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(GDN|Display).*”) THEN “Display”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(Download|Install|IOS|Android|App).*”) THEN “App”
WHEN Source/Medium = “google/cpc” AND REGEXP_MATCH(Campaign, “.*(Custom Affinity.*”) THEN “Custom Affinity”
ELSE “Other”
END

 

Screen Shot 2016-11-02 at 14.38.27.png

 

 

 

 

 

 Thanks, 

 

 

Calculated Field - Formula Parsing Error

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭

it's difficult to see from your code, but when I cut and paste it into an editor, there is no "space" characters between one line and the next. When Data Studio receives a "paste" from an outside source such as an editor, then linebreaks are removed and not replaced by spaces.

 

If you make a rule to always use a space to indent every line (except the first), then this will be resolved.

 

If that is not the problem, some more info is needed.

 

Calculated Field - Formula Parsing Error

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hello,

 

Yes, I did exactly as you said, put 'space's between the lanes before the copy paste. 

 

I think this might be about the length of the formula. When I try it with fewer rows it gives no error. And when I try to create it part by part (rather than copy-paste-ing whole formula) after one point it does not allow me to paste any more. 

 

Thanks,

Calculated Field - Formula Parsing Error

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Hi there,

 

Did you find out the maximum length of the field?

Re: Calculated Field - Formula Parsing Error

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
No, I was not able to get any info on that. The following format works for
me at the moment no matter how long it is. So, I believe at the moment
there was another issue and it got fixed.

CASE WHEN REGEXP_MATCH(Source, ".*(facebook).*") THEN "Facebook.com"
WHEN REGEXP_MATCH(Medium, ".*(organic).*") THEN "Organic"
WHEN Source/Medium = "google / cpc" THEN "Paid Trafik"
WHEN REGEXP_MATCH(Source/Medium, ".*(mail).*") THEN "Email"
WHEN REGEXP_MATCH(Source/Medium, ".*(direct|referral).*") THEN "Direct
Trafik"
ELSE "Other" END

Thanks,


--



Data Driven Marketing



Cem TANRIVERDİ
Consultant,
Digital Intelligence & Performance Consulting
Google AdWords Certified Partner
Doubleclick Studio Certified Partner
YouTube MH Badge Certified Partner
Google Analytics Certified Partner
Google Analytics Premium Reseller
Optimizely Two Star Solutions Partner
Searchmetrics Sapphire Partner
SimilarWeb Partner