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

Help with calculated metric using the 'entrances' metric

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi there

I'm trying (but currently failing) to create a create a calculated metric to do the following;

 

I want to be able to express as a %, the number of entrances to pages on the website that don't include .html in their path name and divide this number by the total number of entrances

 

 

 

I know that the metric to use is 'Entrances' but beyond that I;m a little stuck. Any help would be very gratefully received

 

 

Re: Help with calculated metric using the 'entrances' metric

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆

I have a similar scenario for one of my clients, where they have a number of landing pages going through "post.aspx". So I tried to do what you asked.

 

I'm afraid there's no way to do it.

  •  DS doesn't support TOTAL(), so you can't do "SUM of Landing Page Sessions matching .htm / TOTAL(Sessions)"
  • I tried using a CASE such as CASE WHEN REGEXP_MATCH(Landing Page, 'fiche.aspx') THEN Sessions ELSE 0 END, but DS complains "An expression can have either metrics or dimensions, but not both" - I wonder why, because this logic would make sense

The best I was able to do is create two Scorecards:

  1. Entrances
  2. Entrances with the filter "EXCLUDE Landing Page Contains .htm"

2017-06-27_09-12-22.png

We see what we want... except we can't do the calculation...

I'm curious to know if someone will find a way to do it!

Help with calculated metric using the 'entrances' metric

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆

Maybe you can use the MAX()-function to calculate the sessions?
Something like: MAX(CASE WHEN REGEXP_MATCH(Landing Page, 'fiche.aspx') THEN 1 ELSE 0 END)

You can find more information in the article "Conditional calculated fields" in Data Studio help.

 

Kind regards

Sascha

Help with calculated metric using the 'entrances' metric

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Thanks Sascha - this is helpful but wouldn't it return a count of the sessions that match the condition you set, rather than the percentage of all entrances?

Help with calculated metric using the 'entrances' metric

Follower ✭ ✭ ☆
# 5
Follower ✭ ✭ ☆

Yes, that's right!

I think on this basis, you can then determine the percentage in another formula?

 

Kind regards

Sascha

Help with calculated metric using the 'entrances' metric

Explorer ✭ ✭ ☆
# 6
Explorer ✭ ✭ ☆

Sascha - doing MAX(CASE WHEN REGEXP_MATCH(Landing Page, 'fiche.aspx') THEN 1 ELSE 0 END) will inevitably return 1 as soon as one Landing Page contains fiche.aspx... so that doesn't work.