Data Studio
2.3K members online now
2.3K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Can I rename values within a dimension?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi there Smiley Happy 

 

In a bar chart, is it possible to change the name of the values within a dimension?

So, I set up a chart with dimension 'shopping stage' along one axis and the values for 'sessions' along the other axis. But I'd like to change/rename the way the different shopping stages apea (e.g. 'ALL_VISITS')chart

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Anouka S
May 2017

Can I rename values within a dimension?

Follower ✭ ☆ ☆
# 2
Follower ✭ ☆ ☆

Hey Anouka,

 

Yes this is possible using regular expressions, just create a new custom dimension using this code. You can rename the name of each category as you like, this might not cover all the shopping stages so I would be aware of that!

 

CASE
WHEN REGEXP_MATCH (Shopping Stage, "ALL_VISITS") THEN "All Visitors"
WHEN REGEXP_MATCH (Shopping Stage, "PRODUCT_VIEW") THEN "Product Viewers"
WHEN REGEXP_MATCH (Shopping Stage, "CHECKOUT") THEN "Purchasers"
WHEN REGEXP_MATCH (Shopping Stage, "ADD_TO_CART") THEN "Add to Cart"
WHEN REGEXP_MATCH (Shopping Stage, "ALL_VISITS") THEN "Transaction"
WHEN REGEXP_MATCH (Shopping Stage, "NO_SHOPPING_ACTIVITY") THEN "No Shopping Activity"
ELSE "Other"
END

 

Hope that helps,

Sam

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Anouka S
May 2017

Can I rename values within a dimension?

Follower ✭ ☆ ☆
# 2
Follower ✭ ☆ ☆

Hey Anouka,

 

Yes this is possible using regular expressions, just create a new custom dimension using this code. You can rename the name of each category as you like, this might not cover all the shopping stages so I would be aware of that!

 

CASE
WHEN REGEXP_MATCH (Shopping Stage, "ALL_VISITS") THEN "All Visitors"
WHEN REGEXP_MATCH (Shopping Stage, "PRODUCT_VIEW") THEN "Product Viewers"
WHEN REGEXP_MATCH (Shopping Stage, "CHECKOUT") THEN "Purchasers"
WHEN REGEXP_MATCH (Shopping Stage, "ADD_TO_CART") THEN "Add to Cart"
WHEN REGEXP_MATCH (Shopping Stage, "ALL_VISITS") THEN "Transaction"
WHEN REGEXP_MATCH (Shopping Stage, "NO_SHOPPING_ACTIVITY") THEN "No Shopping Activity"
ELSE "Other"
END

 

Hope that helps,

Sam

Can I rename values within a dimension?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Great, this works perfectly! Now I can rename AND NUMBER the values so I can work around that weird glitch where checkout value is higher than add-to-cart :-O (yes, we're working on that one)

Re: Can I rename values within a dimension?

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Hey,

I am looking to do the same thing except it is for a table.

 

I want to rename my ad group names to show as another TEXT.

 

Used the below function but it doesn't seem to be working!

 

CASE WHEN REGEXP_MATCH (ad group, "Standardization") THEN "Standardization in oil and gas: Where can it really happen?" WHEN REGEXP_MATCH (ad group), "General") THEN "General" WHEN REGEXP_MATCH (ad group, "Automated") THEN "Fully automated operations: A realistic scenario for the foreseeable future?" ELSE "Other"END

 

Any help would be great

 

Abi

Can I rename values within a dimension?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hey,

I am looking to do the same thing except it is for a table.

 

I want to rename my ad group names to show as another TEXT.

 

Used the below function but it doesn't seem to be working!

 

CASE WHEN REGEXP_MATCH (ad group, "Standardization") THEN "Standardization in oil and gas: Where can it really happen?" WHEN REGEXP_MATCH (ad group), "General") THEN "General" WHEN REGEXP_MATCH (ad group, "Automated") THEN "Fully automated operations: A realistic scenario for the foreseeable future?" ELSE "Other"END

 

Any help would be great

 

Abi

Re: Can I rename values within a dimension?

Explorer ✭ ✭ ☆
# 6
Explorer ✭ ✭ ☆

Hi @Abi R,

First, create a table chart with the dimension "ad group" and a metric to watch about your values.

 

When you are editing your data source in Data studio, create a field "NewAdGroup" with this formula : 

 

CASE 
WHEN REGEXP_MATCH (ad group, "Standardization") THEN "Standardization in oil and gas" 
WHEN REGEXP_MATCH (ad group, "General") THEN "General"
WHEN REGEXP_MATCH (ad group, "Automated") THEN "Fully automated operations" 
ELSE "Others"
END

 

Add this new field "NewAdGroup" in your previous chart table and check if i this is working good.

 

Turn back in your field editor to adjust your value as "Fully automated operations : A realistic scenario for the foreseeable future?"

Be careful, some caracters like " : " or " ? " may make some wrong results.

 

Can I rename values within a dimension?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Hi Patrick,

 

Thanks for getting back to me. I tried the exact way you mentioned and it isn't working. 

I get the response "Could not parse formula"

Re: Can I rename values within a dimension?

Explorer ✭ ✭ ☆
# 8
Explorer ✭ ✭ ☆

it's not working because you need to delete the "space" between
REGEXP_MATCH and (

Copy and paste my formula below, and replace Event Label directly in the editor with your "ad group"

 

CASE WHEN REGEXP_MATCH(Event Label, "Standardization") THEN "Standardization in oil and gas" WHEN REGEXP_MATCH(Event Label, "General") THEN "General" WHEN REGEXP_MATCH(Event Label, "Automated") THEN "Fully automated operations" ELSE "Others" END

 

Your formula should be display like this

formula.JPG

 

Can I rename values within a dimension?

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Ahhh great, it was the space thank you!

Can I rename values within a dimension?

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭

Hey Sam,

 

Could you tell me where I can create these rules in Data Studio? For some reason I just can't find it.