RodolfoAntonici
RodolfoAntonici

Reputation: 1635

Calculated field to sum a specific event

On Looker Studio I'm importing the data that comes from GA4 and I want to do the following:

Given a view, I want to understand which buttons the user has pressed and how may times that was made on a daily basis. I have the following events:

Since Looker doesn't allow me to simply search for the event name and get its count, I've figured out that I need to add a calculated field using the following:

Name: share button event count Formula:

CASE 
  WHEN Event name = "share_button_pressed" THEN 1
  ELSE 0
END

And on the field I should use either a COUNT or SUM. Both of them return a random value that doesn't match what it should return.

There's any way around it?

Upvotes: 0

Views: 271

Answers (1)

ali izadi
ali izadi

Reputation: 539

When you use a calculated field as a dimension and select a metric (like event count), Looker Studio should re-aggregate the aggregated metrics, defaulting to the sum. It does not allow for other types of aggregation (such as average or maximum) and displays a flag indicating a data quality issue.

In this case, using the event count metric will yield correct results because it sums records for the defined event name. However, for other metrics like sessions and users, it may retrieve incorrect numbers due to differences in scope and improper aggregation.

A better alternative is to use a window function and query GA4 data in BigQuery, then connect it to Looker Studio.

Upvotes: 0

Related Questions