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.8K members online now
3.8K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Calculated metric filter by event

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I am trying to do something like this in a calculated metric in order to count the number of events where the category = registration on mobile and the action = success:

 

COUNT(CASE WHEN (  Event Category = "Registration (Mobile)" AND Event Action = "Success" ) THEN 1 ELSE 0 END)

 

However this does not seem to work properly. Is there some other way to do this? Or is my syntax incorrect?

 

Thanks

Calculated metric filter by event

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

 Hi Tamara,

Try like this...

SUM(CASE WHEN REGEXP_MATCH(Event Category, "Registration (Mobile)") AND REGEXP_MATCH(Event Action, "Success") THEN 1 ELSE 0 END)

Smiley Happy

Calculated metric filter by event

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Luis,

 

I tried COUNT instead of SUM because SUM adds the Event value but this still did not work :/ I get a large number which has nothing to do with the correct value :/ Also the THEN is not in purple when there are two regexp . When I remove the 2nd one it becomes purple again.

 

Regards,

Tamara