kitmin
kitmin

Reputation: 35

Display Sessions Metrics on specific dates using Calculated Field?

Hello I want to display the following data in my Looker Studio Report:

enter image description here

My Data Source is from GA4.

I'm using session default channel group as the dimensions and for the metrics, I'm using a calculated field with the code below:

CASE
WHEN Date >= DATE(2024, 6, 25) AND Date <= DATE(2024, 7, 24) THEN Active users
ELSE 0
END

Unfortunately, I am getting the following error:

Sorry, calculated fields can't mix metrics (aggregated values) and dimensions (non-aggregated values). Please check the aggregation types of the fields used in this formula.

I've tried simplifying the code to better understand the issue with the following:

CASE 
WHEN Date = DATE(2024, 07, 07) THEN Sessions
ELSE 0
END

Unfortunately I'm still getting the same error message.

How can I achieve this? Thank you

Upvotes: 0

Views: 33

Answers (1)

Le&#243;n
Le&#243;n

Reputation: 96

Have you tried encapsulating it in a SUM?

SUM(IF(Date >= DATE(2024, 6, 25) AND Date <= DATE(2024, 7, 24), Active users, 0))

Maybe then you can mix the active users (metric) that meet the criteria you placed on date (dimension).

Upvotes: 0

Related Questions