Use the CONCAT function to create Custom Dimensions in Google Data Studio

Use the CONCAT function to create Custom Dimensions in Google Data Studio

In this post I’ll show you how you can use the CONCAT function in Google Data Studio to create Custom Dimensions.

In this case, we can combine multiple different dimensions into one dimension and filter our data accordingly.

Using the CONCAT function

CONCAT is one of many Google Data Studio functions. It allows us to join various strings together.

Here is an example below. I have a data source in Google Sheets showing some made-up people (and randomly generated faces)

We have various pieces of information about these people. In order to display this info as a coherent sentence we can use the CONCAT function.

For example for the description we have the formula to create a custom field.

CONCAT(Name," is a ",Age,"-year-old ",LOWER(Occupation)," living in ",Location,".")

Start your formula with CONCAT and then separate each competent with a comma. For existing fields you can just add them

Using the CONCAT function in google data studio

And for the Hobbies sentence we use this formula to create a custom field;

CONCAT(Name," enjoys ",LOWER(Hobby 1),", ",LOWER(Hobby 2),", and ",LOWER(Hobby 3),".")

Notice we can also use the LOWER function to convert any text to lowercase only. This makes the sentence more natural.

Using the CONCAT function in google data studio

Below you can see the Data Studio report with the Description and Hobbies fields in the two text boxes.

Creating natural sound descriptive sentences is a great use of the CONCAT function. Another use is creating custom dimensions which I will show below.

Creating Custom Dimensions using the CONCAT function

Another great use of the CONCAT function is to create custom dimensions.

Let’s say for example that we want to separate our users into segments based on their City and how they arrived on our website (Default Channel Grouping). To do this we can create the following custom field in our data source;

To do this we simply create a new field using this formula;

CONCAT(Town/City," (",Country,")"," - ",Default Channel Grouping)

It combines the dimensions Town/City, Country and Default Channel Grouping into one field.

Using the CONCAT function in google data studio

Below we have two tables. The top table shows each of the three dimensions we’ve combined in seperate columns. The bottom table shows the new CONCAT field with all three dimensions in one column. We can see that Organic users from London are 223 in both tables. This shows our CONCAT formula is working correctly.

Two tables. One table shows the segment as three columns the second table shows it as one column in google data studio

Below is the finished Google Data Studio report showing how we can use this CONCAT function to quickly and easily create new dimensions to better segment our audience.

Conditional Formatting

Because most of the traffic is Organic Search, I’ve decided to highlight traffic that comes from Social or Direct.

So I’ve added in two conditional formatting rules to the left-hand table.

Conditional formatting in google data studio.

It then makes it easier to spot the Social or Direct city/country/channel dimensions.

An example of using conditional formatting in google data studio

My other Blog Posts

I hope you enjoyed this article. If you liked it you may like my other blog posts!

I’m Michael


I’m a digital analyst with seven years experience in digital marketing. I’m skilled in web analytics, tag management and data visualization.

Get in touch with me!
LinkedIn
Twitter
Email

I'm Michael