Using Parameters in Data Studio

Using Parameters in Data Studio

Are you looking for ways to make your data visualizations more engaging? Would you like to allow users to customize reports by inputting their own values into charts and calculations? In Google Data Studio, this type of interactivity can be achieved by using parameters.

Parameters can be used in calculated fields to display results based on user input. They can also be passed back to a custom SQL query for BigQuery or to a community connector.

You can allow users to change or input the value of a parameter through controls on a report, like an text input, dropdown, or slider. Parameter values can also be set by appending information to the query string of the report URL.

Adding a Parameter in Data Studio

To pass parameters into BigQuery and community connector data sources, you will need to define the parameter respectively in the SQL query or in the community connector configuration. To use parameters in calculated fields, you can add the parameters directly to your data source by following the steps below:

  1. In your data source, click to “Add a Parameter.”
  2. Configure the parameter name, ID, type, and permitted values. For example, here is the configuration for the “Freshness Weight” parameter used in the calculated score report below. This parameter accepts only whole numbers between 1 and 5.
  3. Click to Save the parameter.

Once your parameter is created, it will appear as a purple field in your data source.

To allow report viewers to change the value of the parameter, add a control to your report. You can either drag-and-drop the parameter onto the canvas or click “Add a Control” from the toolbar and select the parameter as the control field.

Here are a few examples that demonstrate how parameters can be used to enhance the interactivity and functionality of Data Studio reports.

Google Analytics Campaign URL Builder

If you use Google Analytics to measure the results of your marketing campaigns, you are likely familiar with the Campaign URL Builder. We thought it would be interesting to re-create a simple campaign URL builder entirely within Data Studio:

View in Data Studio

This report uses parameters to accept values for the base URL, campaign, source, and medium—the essential components of a properly tagged campaign link. The full campaign URL is then concatenated in a calculated field and displayed in the lower box. The campaign URL automatically updates as you fill out the fields above. Try it out yourself!

Calculated Score with Adjustable Weights

A calculated score or index often includes weights on the individual components in the calculation. Perhaps you have an engagement score or lead score that aggregates different customer conversions and micro-conversions by assigning a weight to each. However, these weights are often arbitrary, and you may wish to experiment with different values.

We have demonstrated this concept with a fun example: Stephen Curry’s ratings of popcorn at every NBA arena. This dataset comes from a New York Times article and was featured in Makeover Monday. Curry rated the popcorn at each stadium on 5 factors: butteriness, crunchiness, freshness, presentation and saltiness. Each factor was scored from 1 to 5, and the total score was the simply the sum of all five.

But what if some factors are more important than others? In this report, you can add weights to each popcorn quality to create your own custom score. Is the butteriness of your popcorn super important to you? Crank it up to 5! Don’t care about the presentation? Drop it to zero. Adjust each weight using the sliders at the top of the report. Each slider controls a parameter that influences the calculation of “Your Score” shown in the table.

View in Data Studio

Break-Even Calculator

This calculator allows you to enter cost and sales values to find a simple break-even point in units sold. The inputs at the top of the report control parameters used in the break-even calculation. The parameters are also used to update the sales and cost functions on the chart. Try it yourself!

View in Data Studio

Weather Forecast

One of the first community connector examples we ever built in Data Studio was a weather forecast. You can see it in Are You Ready to Get Creative with Data Studio Connectors? That report was fixed to returning the weather for Toronto. By using parameters, we can now create this dynamic report that lets you get the weather forecast for any city around the world!

View in Data Studio

The parameter inputs for City and Country Code are passed directly into our custom OpenWeatherMap connector. The time zone control allows you to shift the times displayed to match the local time of the city entered.

As noted above, you can also set the value of parameters via the report URL query string. This weather forecast report is a great use case for this functionality. Just by using different links, you can directly load the weather for San Francisco, New York, Paris, Tokyo, and Sydney. For more information, check out the full documentation on how to configure parameters via report URLs.

We hope these examples give you some ideas on how to use parameters to enhance your Data Studio reports, and we’re really just scratching the surface here. Let us know what you create and drop us any questions in the comments below.

Complete list of posts in our 2020 Data Studio series:

1. Visualizing the COVID-19 Pandemic in Google Data Studio
2. Creating a Google Analytics Dashboard in One Click
3. Using Google Maps in Data Studio
4. Visualizing BigQuery Public Datasets in Data Studio
5. Measuring Web Vitals – Part 2: Monitoring in Data Studio
6. Using Parameters in Data Studio (this post)
7. How to Style Links in Data Studio
8. Using Filter Controls in Data Studio
9. Extracting a Theme from an Image in Data Studio
10. Building a Google Analytics 4 Dashboard in Data Studio
11. How to Convert Text to Dates in Google Data Studio
12. 12 Tips for Enhancing Your Tables in Data Studio

By |2020-12-16T16:30:29-05:00December 8th, 2020|0 Comments
Categories: Data Studio

Leave A Comment