You might want to make your data visualizations more engaging. With custom parameters in Google Data Studio (or some call it "Data Studio Variables"), users can input their own values into charts and calculations.
We mentioned dimensions and metrics here. They are the main segments of data that we use on charts and reports. But they are only bringing values from the data sources. What are you going to do when you want to input a unique or custom variable which is not in the data source but relevant to your reports?
For example, while making reports for Google Ads, you might want to add your monthly target budget as a variable.
💡 You can interact with user-provided information using parameters, and they can send user-provided information to computed fields and connections.
How parameters work
In a computer language, parameters function similarly to variables. Parameters are used for three basic purposes:
- If you want to display results based on user input, you can utilize parameters in computed fields.
- In a BigQuery data source, you can feed parameters back to the custom SQL query that you created.
- To communicate with a community connector, you can send parameters.
These are the sources from which parameters can obtain their information:
- From a default value defined for the parameter.
- From the component properties panel.
- From a control placed on the report.
- From the link to the report.
In the report and data source editors, you'll locate parameters at the bottom of the list of accessible fields, near the end of the list of available fields. Parameters are represented via purple fields.
How to Create a Parameter?
- Sign in to your Data Studio account.
- Afterwards, click on edit your data source.
- ADD A PARAMETER can be found in the upper right corner. Adding a parameter to a report while it is being edited is also possible by selecting a component and afterwards selecting ADD A PARAMETER in the bottom right corner. Make sure to choose a component that corresponds to the desired data source. In your data source, parameters display as a purple field.
- Set the parameter's default value and options.
What is the best way to set a value for a parameter?
The following options can be used to configure a parameter in the data source. See the articles linked above for more information on the BigQuery connection and community connector parameters.
Parameter name: When you run reports or access data sources, you'll see the name of the parameter in the list of fields that are available. The parameter in a computed field is also known by this name, which you'll use to refer to it in other places as well.
Parameter ID: The ID of the parameter has been set by default. The parameter ID is used internally by Data Studio to distinguish between different parameters in the same dataset. It is not visible to report viewers.
The parameter ID will become invalid if the component or computed field that contains the parameter is changed.
Changing the Parameter ID will break components and calculated fields that include the parameter.
Data type: parameters can store text, numbers, or Boolean (true/false) values.
Permitted values: This sets the attributes that can be entered by the viewer into the input field.
If you want to specify a list of values, choose that option and then enter the permissible value, as well as an optional display name, in the appropriate field. To add additional things to the list, select Add Option from the drop-down menu.
When defining a range of permissible values, provide the minimum and maximum values that fall inside that range.
Default value: enter a value for the parameter that will be used as a starting point.
How to add a custom parameter to your Data Studio report
After creating and configuring your custom parameter, you would want to add it to your report.
Step 1) Create the desired table
By default when you get to the editing of your report, you’ll have a table present.
The default variables in the table don't match the ones we'd like to put.
You can remove dimensions and/or metrics from the data panel on the right.
Step 2) Add your custom parameter
Search the parameter which you have created at the search bar on the right menu.
Click and drag it to the dimension or metric part of the data menu.
Step 3) Try out the report you just created
Click on the view button on the top right of your screen. Check if the parameter shows the value you added.