We mentioned dimensions and metrics here. They are main segments of data which we use on charts and reports. But they are bringing values from the data sources. What is 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.
💡 Parameters let you interact with user-provided data and they pass user-supplied data to calculated fields and connectors.
How parameters work
Parameters act like variables in a programming language. Parameters serve 3 primary uses:
- You can use parameters in calculated fields to display results based on user input.
- You can pass parameters back to the custom SQL query in a BigQuery data source.
- You can pass parameters back to a community connector.
Parameters can get their data from the following places:
- 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.
You'll find parameters at the bottom of the list of available fields in the report and data source editors. Parameters appear as purple fields.
How to create a parameter
- Sign in to Data Studio.
- Edit your data source.
- In the upper right, click ADD A PARAMETER.You can also create a parameter while editing a report by selecting a component, then in the bottom right, clicking ADD A PARAMETER. Be sure to select a component based on the desired data source.
- Configure the parameter's options and default value.
How to configure a parameter
Use these options to configure a parameter in the data source. For BigQuery connector and community connector parameters, see the articles referenced above.
Parameter name: you'll see this name in the lists of available fields in your reports and data sources. This is also the name you'll use to refer to the parameter in a calculated field.
Parameter ID: set by default. The parameter ID is used internally by Data Studio to identify the parameter. Report viewers don't see it.
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: specifies the values that can be input by the viewer.
To specify a list of values, choose that option, then enter the acceptable value, along with an optional display name. Click Add option to add more items to the list.
To specify a range of permitted values, enter the minimum and maximum values for the range.
Default value: specify a starting value for the parameter.