How to change Google Map metrics using a Parameter in Data Studio

In this post I’ll show you a method for how to change Google Map metrics using a Parameter in Google Data Studio.

At the time of writing it is not possible to switch between metrics on a Google Map in Data Studio. If you use a Geo Map you can use Optional Metrics to change the data displayed on the map, but this is not possible if you use a Google Map. But you can get around this by using a parameter.

Below is a video of how it should work. The actual Data Studio dashboard is at the end of the article.

Step 1: Extract Google Analytics data using the Extract Data Connector

So I tried using this method with the regular Google Analytics connector and it didn’t work. I then tried using the Extract Data connector and it worked fine. You’re welcome to try with the regular Google Analytics data though!

I extracted the following data including the following metrics; Sessions, Users, Page Views, Goal Completions and Goal Conversion Rate.

extract data using extract data connector

Step 2: Create a Map Metric Parameter

The next step is to create a parameter named map_metric_parameter. It is a text parameter and has the following list of values;

  • Sessions
  • Users
  • Page Views
  • Goal Completions
  • Goal Conversion Rate
a parameter for changing metrics on a google map in data studio

Step 3: Create a Map Metric Field

Now create a calculated field where the value is simply the parameter you’ve just created.

We will name this map_metric_field.

a calculated field for switching google map metrics in data studio

Step 4: Create your Map Metric that you will use in the Google Map

Now that you’ve created your map_metric_parameter and the map_metric_field based on the parameter, we can create the new calculated field we will be using with our Google Map in the report.

Use the following CASE statement in a new calculated field.

CASE map_metric_field
WHEN 'Sessions' THEN Sessions
WHEN 'Users' THEN Users
WHEN 'Page Views' THEN Page Views
WHEN 'Goal Completions' THEN Goal Completions
WHEN 'Goal Conversion Rate' THEN Goal Conversion Rate
END 

It should look like this.

a case statement for altering the google map metric in google data studio

Save it and now we should have three new calculated fields in our data source as shown below.

dimensions in google data studio

Step 5: Building our Data Studio report

Add a Google Map with Town/City as the location dimension and map_metric as the metric.

a google map with an adjustable map metric in data studio

I’ve also created a table with Town/City, Country and map_metric.

a table with a changeable map metric in google data studio

Add a Drop down Control filter was map_metric_parameter as the Control field.

a parameter filter in google data studio

I’ve also added in a table with all the design elements (row numbers, pagination etc) hidden so that it displays the name of the map metric. Choose the dimension for the table to be map_metric_field.

Step 6: Looking at the final, finished Google Data Studio report

Below is the finished Google Data Studio report. Please note that you can’t view Google Maps inside an embedded Data Studio report and you need to open the report in Data Studio by clicking on the logo in the bottom right corner of the report.

Alternatively click on this link to open the report.

My Other Blog Posts

I hope you found this article about changing Google Map metrics using a Parameter useful and interesting! If you did you might like my other blog posts.

Michael Howe-Ely