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

Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

Greetings,

 

I have a series of different Event Categories, is it possible to create a filter for a specific one to be used as a Calculated Metric.  For example:  I want to only count instances where "Forms" appear in "Event Category" and then use that calculated metric as part of another in a calculation (Number of Forms / Users)

 

Any help would be appreciated.  Thanks! Smiley Happy

 

Signed,

John

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author John H
July 2016

Re: Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Google Employee
# 2
Google Employee
You may use the CASE statement to do this type of 'conditional counting'.

For example, you can define the following calculated metric:
SUM ( CASE WHEN REGEXP_MATCH(event_category, '.*Forms*.') THEN 1 ELSE 0 END )

See the following help article for details on syntax:
https://support.google.com/360suite/datastudio/table/6379764?authuser=0

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author John H
July 2016

Re: Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Google Employee
# 2
Google Employee
You may use the CASE statement to do this type of 'conditional counting'.

For example, you can define the following calculated metric:
SUM ( CASE WHEN REGEXP_MATCH(event_category, '.*Forms*.') THEN 1 ELSE 0 END )

See the following help article for details on syntax:
https://support.google.com/360suite/datastudio/table/6379764?authuser=0

Re: Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆
Thank you Smiley Happy

Re: Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Follower ✭ ☆ ☆
# 4
Follower ✭ ☆ ☆
A new question to this. Is it possible using this formula to add up all the entries where (event_category, '.*Forms*.') is True? (Ex: There is 60 Events where Event_Category = "Forms")

Thank you again.

Signed,
John

Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Follower ✭ ☆ ☆
# 5
Follower ✭ ☆ ☆

Hi,

 

I am using the following formula to create a metric based on a specific Event Category:

 

SUM (CASE WHEN REGEXP_MATCH(Event Category, 'Leads Compradores') THEN 1 ELSE 0 END)

 

However, the metric only shows the number 1 and does not add (SUM) all the occurrences inside the Event Category. How can I fix this issue?

 

Thanks for your help!

 

Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

This did not work for me. It returns only 1...

 

I want to create a table where the first column is date and the second column is unique events with the filter eventAction contains "form". I´ve tried REGEXP_MATCH(EventAction, '.*form*.') THEN 1 ELSE 0 END), but it returns 1 and not the number of unique events.

 

Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Follower ✭ ✭ ☆
# 7
Follower ✭ ✭ ☆

I have same problem -- it returns 1.

 

Are we all missing some key point, please?

Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Google Employee
# 8
Google Employee

Indeed. The proposed derived metric does not work as I expected when the data source is based on the GA connector. I apologize for misleading everyone.

 

I'll get back on this thread when I have a solution that works. 

 

 

Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

The same for me.

Creating a Filter as a Calculated Metric - Google Data Studio - Possible?

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭

Also curious for the solution to this issue. Having a filter in the calculated field would solve a lot of issues I currently have. Thank you.