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

Event tracking and Event Category in DataStudio

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I'm pretty new to DataStudio and I don't have any experience of creating calculated metrics / formulas etc, so please go easy on me!

 

In GA I have 2 event categories

 

'editorial' and 'products'

 

I would like to create a table that counts every time one of these events has been triggered.

I have been trying to implement using the following formula:

 

Event Category = 'editorial'

 

but this is an 'Invalid formula'

 

After a bit of trawling on this forum and trying to apply other people's problems to my own I finally amended the formula to be this, which hallelujah is a valid formula.

 

SUM(CASE WHEN (Event Category = 'editorial') THEN 1 ELSE 0 END)

 

The only problem is, when I add it as a metric to my table, it makes all my other data in the table disappear and replaces it with a 'no data' message.

Any help would be very appreciated!

 

Thanks

Andy

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Andy W
July 2017

Event tracking and Event Category in DataStudio

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

How do you want your data to look? Do you just want it to count how many events were editorial and how many were products? If so, you don't need a case statement. You can use a bar chart (or pie) and use the category as the dimension and "total events" as the metric. It will automatically sum them for you. 

 

If you want to break editorial down by event label as well, you could pull event label as a dimension into whatever type of chart you're using, use total events as the metric, and then apply a filter to the chart for the event category editorial. 

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Andy W
July 2017

Event tracking and Event Category in DataStudio

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

How do you want your data to look? Do you just want it to count how many events were editorial and how many were products? If so, you don't need a case statement. You can use a bar chart (or pie) and use the category as the dimension and "total events" as the metric. It will automatically sum them for you. 

 

If you want to break editorial down by event label as well, you could pull event label as a dimension into whatever type of chart you're using, use total events as the metric, and then apply a filter to the chart for the event category editorial. 

Event tracking and Event Category in DataStudio

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you so much! This worked perfectly!