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

Sessions of a certain duration as a proportion of all sessions

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi All 

 

I am trying to build a report that shows the sessions where users stay on my site for over 30 secs as a proportion of total sessions. I have managed to get somewhere by building a calculated field using

 

(CASE WHEN Session Duration > 20 THEN "High Quality" ELSE "Low Quality" END)

 

This gives me the split but ideally i want to show the proportion to total session and how it changes over time. 

 

Thanks in advance for any hints 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Gavin B
March 2017

Sessions of a certain duration as a proportion of all sessions

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭

 

I am not sure why I was not able to create a calculated field directly but I manage to do it with the following:

 

Total High Quality Sessions => SUM(CASE WHEN Session Quality = 'High Quality' THEN 1 ELSE 0 END)

% of HQ Sessions => Total High Quality Sessions / Sessions

 

Set % of HQ Sessions as a Percentage and there you have your %.

 

Hope this helps.

 

Would be grateful if anyone could enlighten me why I cannot do the following in a single calculated field:

 

(SUM(CASE WHEN Session Quality = 'High Quality' THEN 1 ELSE 0 END)) / Sessions

 

Thanks.

 

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Gavin B
March 2017

Sessions of a certain duration as a proportion of all sessions

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭

 

I am not sure why I was not able to create a calculated field directly but I manage to do it with the following:

 

Total High Quality Sessions => SUM(CASE WHEN Session Quality = 'High Quality' THEN 1 ELSE 0 END)

% of HQ Sessions => Total High Quality Sessions / Sessions

 

Set % of HQ Sessions as a Percentage and there you have your %.

 

Hope this helps.

 

Would be grateful if anyone could enlighten me why I cannot do the following in a single calculated field:

 

(SUM(CASE WHEN Session Quality = 'High Quality' THEN 1 ELSE 0 END)) / Sessions

 

Thanks.

 

Sessions of a certain duration as a proportion of all sessions

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you. worked a treat