In this post I’ll show a method for using Parameters to change Column Dimensions in Data Studio.
Before we begin…
Before I begin I need to say that if you are interested in learning more about Parameters in Google Data Studio you read this article: Google Data Studio secondary dimension like inside Google Analytics by Mehdi Oudjida as it explains very clearly how to use parameters in Data Studio. I was familiar with parameters from Tableau but Mehdi’s blog posts helped me understand how to implement it properly in Data Studio. Also check out Mimoune Djouallah on Twitter who regularly posts innovative ways to use parameters in Data Studio. Also read up the official Google Analytics notes on Parameters in Data Studio.
Step 1: Create Two Parameters
In this example I’m using standard Google Analytics data from the Google Analytics connector in Data Studio.
The first step is to create two identical parameters. We will call these column_1_parameter and column_2_parameter.
Set up the list of values and display names identically.
For column_1_parameter choose Continent as the default value and for column_2_parameter choose Default Channel Grouping as the default value.
Step 2: Create Two Column Fields
The next step is to create two calculated fields based off each parameter.
Create a field called column_1_field where the formula is simply column_1_parameter. Likewise create a field called column_2_field where the formula is (you guessed it) column_2_parameter as shown below.
Step 3: Create Two Dimensions using CASE statements
The next step is to create two identical dimensions using CASE statements. Below is the CASE statement which you can copy and paste.
CASE column_1_field WHEN 'Continent' THEN Continent WHEN 'Country' THEN Country WHEN 'Device Category' THEN Device Category WHEN 'Default Channel Grouping' THEN Default Channel Grouping WHEN 'Source' THEN Source WHEN 'Medium' THEN Medium ELSE "Other" END
Below is what it should look like. Name them column_1_dimension and column_2_dimension.
Create two identical dimensions.
- column_1_dimension based on column_1_field
- column_2_dimension based on column_2_field
Once you’ve gone through this hellish ordeal of creating the two parameters, two fields, and two dimensions you should have the following new fields in your data source.
Now we can use them to create your Data Studio report!
Pictured below is the typical user reaction upon completing the various steps outlined above.
Step 4: Building the Data Studio report
So the main purpose of having two column dimensions is that we can switch between them easily.
To enable this set up a table with Sessions as the metric. Then add column_1_dimension and column_2_dimension as the two dimensions for the table as shown below.
Add two filters to your report. I’ve used the Control Drop-down list type of control filter.
To filter column_1_dimension add column_1_parameter to the first filter.
To filter column_2_dimension add column_2_parameter to the second filter.
Below is a video showing how to use the two filters.
And below is the actual Google Data Studio report so you can play around with it yourself!
My Other Blog Posts
I hope you found this article about how to use Parameters to change Column Dimensions useful! You might enjoy my other blog posts.