How to split event values in Google Data Studio with Calculated Fields
up vote
1
down vote
favorite
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).
- Ex: Event Action A * 1.37
- Ex: Event Action B * 2.22
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!
google-analytics google-tag-manager google-data-studio
add a comment |
up vote
1
down vote
favorite
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).
- Ex: Event Action A * 1.37
- Ex: Event Action B * 2.22
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!
google-analytics google-tag-manager google-data-studio
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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).
- Ex: Event Action A * 1.37
- Ex: Event Action B * 2.22
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!
google-analytics google-tag-manager google-data-studio
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).
- Ex: Event Action A * 1.37
- Ex: Event Action B * 2.22
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!
google-analytics google-tag-manager google-data-studio
google-analytics google-tag-manager google-data-studio
asked Nov 18 at 19:29
bytebybyte
347
347
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
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)
Thanks for your reply! I created the first field, but the second field throws 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. This seems to be caused by Event Value being an aggregate [AUT] in the field name.
– bytebybyte
Nov 20 at 2:16
1
Ah. A little annoying! Try wrapping the case statement with AVG() so AVG(CASE WHEN... ELSE 0 END). I've edited my answer
– Bobbylank
Nov 20 at 9:20
Got it! That seems to have done the trick, thanks Bobby!
– bytebybyte
Nov 21 at 14:11
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
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)
Thanks for your reply! I created the first field, but the second field throws 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. This seems to be caused by Event Value being an aggregate [AUT] in the field name.
– bytebybyte
Nov 20 at 2:16
1
Ah. A little annoying! Try wrapping the case statement with AVG() so AVG(CASE WHEN... ELSE 0 END). I've edited my answer
– Bobbylank
Nov 20 at 9:20
Got it! That seems to have done the trick, thanks Bobby!
– bytebybyte
Nov 21 at 14:11
add a comment |
up vote
2
down vote
accepted
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)
Thanks for your reply! I created the first field, but the second field throws 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. This seems to be caused by Event Value being an aggregate [AUT] in the field name.
– bytebybyte
Nov 20 at 2:16
1
Ah. A little annoying! Try wrapping the case statement with AVG() so AVG(CASE WHEN... ELSE 0 END). I've edited my answer
– Bobbylank
Nov 20 at 9:20
Got it! That seems to have done the trick, thanks Bobby!
– bytebybyte
Nov 21 at 14:11
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
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)
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)
edited Nov 20 at 9:22
answered Nov 19 at 12:01
Bobbylank
938211
938211
Thanks for your reply! I created the first field, but the second field throws 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. This seems to be caused by Event Value being an aggregate [AUT] in the field name.
– bytebybyte
Nov 20 at 2:16
1
Ah. A little annoying! Try wrapping the case statement with AVG() so AVG(CASE WHEN... ELSE 0 END). I've edited my answer
– Bobbylank
Nov 20 at 9:20
Got it! That seems to have done the trick, thanks Bobby!
– bytebybyte
Nov 21 at 14:11
add a comment |
Thanks for your reply! I created the first field, but the second field throws 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. This seems to be caused by Event Value being an aggregate [AUT] in the field name.
– bytebybyte
Nov 20 at 2:16
1
Ah. A little annoying! Try wrapping the case statement with AVG() so AVG(CASE WHEN... ELSE 0 END). I've edited my answer
– Bobbylank
Nov 20 at 9:20
Got it! That seems to have done the trick, thanks Bobby!
– bytebybyte
Nov 21 at 14:11
Thanks for your reply! I created the first field, but the second field throws 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. This seems to be caused by Event Value being an aggregate [AUT] in the field name.
– bytebybyte
Nov 20 at 2:16
Thanks for your reply! I created the first field, but the second field throws 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. This seems to be caused by Event Value being an aggregate [AUT] in the field name.
– bytebybyte
Nov 20 at 2:16
1
1
Ah. A little annoying! Try wrapping the case statement with AVG() so AVG(CASE WHEN... ELSE 0 END). I've edited my answer
– Bobbylank
Nov 20 at 9:20
Ah. A little annoying! Try wrapping the case statement with AVG() so AVG(CASE WHEN... ELSE 0 END). I've edited my answer
– Bobbylank
Nov 20 at 9:20
Got it! That seems to have done the trick, thanks Bobby!
– bytebybyte
Nov 21 at 14:11
Got it! That seems to have done the trick, thanks Bobby!
– bytebybyte
Nov 21 at 14:11
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53364667%2fhow-to-split-event-values-in-google-data-studio-with-calculated-fields%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown