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

Use regex page to get all pageviews

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all,

 

I'm bulding a dashboard and having problems with metric customization, when I try to get a number of pageviews that have relation with one regex that returns me "Could not parse formula."

 

What I trying to do is that:

 

CASE WHEN REGEXP_MATCH(page,(.+\/p\/.+)) THEN SUM(pageviews) END

 

Does anyone already have this kind of problem?

 

Thank's

1 Expert replyverified_user

Re: Use regex page to get all pageviews

Google Employee
# 2
Google Employee

Hi Felipe --

 

Looks like there are some problems with your CASE statement. You can see the documentation for that function here. I believe you need to address the following:

 

  • You can't use a function like SUM() in the THEN clause
  • You must include an ELSE clause (perhaps some like 'ELSE 0')

 

Assuming you fix these two problems and that your regex in the REGEXP_MATCH is correct then I think your calculated field should work well.

Use regex page to get all pageviews

[ Edited ]
Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆

I believe we cannot mix dimensions and metrics.

 

Page is a dimension, Pageviews is a metric.

 

or maybe I have that wrong...

Use regex page to get all pageviews

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Have you tried creating a custom segment in GA and then importing the segment into DS?