Galat
Galat

Reputation: 477

Google Data Studio Sum with Conditions

I have one metric and one dimension I need to create a calculated field like SQL Query:

sum(new_users) where event_action= "manual_widget_click" / Total_new_Users

I can not understand the logic of formulas in Data Studio. Not here standard functions like 'sumif' or 'where'.... only 'Case When'. But I can not put together a formula...

enter image description here

Upvotes: 2

Views: 8222

Answers (1)

Amira Bedhiafi
Amira Bedhiafi

Reputation: 1

It can be achieved by breaking down the formula into 2 Calculated Fields.

First :

CASE
  WHEN event_action= "manual_widget_click" THEN new_users
  ELSE 0
END

Then :

SUM(event_action= "manual_widget_click" THEN new_users) / Total_new_Users

Upvotes: 3

Related Questions