Reputation: 125
I'm trying to multiply the event value of a certain Event Action (A) by ($x.xx) and the event value of a different type of Event Action (B) by a different amount ($x.xx).
I have Google Tag Manager firing events per click, where the Action is the type of click and Label is the URL. In Google Data Studio, I understand I can use a Calculated Field to multiply [Event Value] by [x amount]. But I'm not sure how to separate this based on the event action.
Is it also possible to do this in one field? Such as:
If (Event Action contains "A" then multiply [event value] by [x], else if Event Action contains "B" then multiply [event value] by [y])
Thanks!
Upvotes: 1
Views: 2002
Reputation: 1946
I don't think you can do it in one step in one field but if you do one field (multiplier) as
CASE
WHEN REGEXP_MATCH("Event Action","A") THEN [yourmultipliervalueX]
WHEN REGEXP_MATCH("Event Action","B") THEN [yourmultipliervalueY]
ELSE 0
END
And then a second field as
multiplier*[event value]
EDIT: To take into account [event value] being an aggregate
AVG(CASE
WHEN REGEXP_MATCH("Event Action","A") THEN [yourmultipliervalueX]
WHEN REGEXP_MATCH("Event Action","B") THEN [yourmultipliervalueY]
ELSE 0
END)
Upvotes: 2