Query result variables let you insert data directly into text elements. For example, you could add text that describes a data point to your report, and then include that data point in the text as a chip. A query result chip updates its value when fresh data is available.
Create a query result variable
To create a query result variable, follow these steps:
- Edit your report.
- Add text to your report, or edit an existing text element.
- Enter
@
to open the variable insert menu. - Click Add a variable to open the Create variable dialog.
- Give your variable a unique name.
- In the Data Source section, select the data source that the query should start from.
- Create a query that returns the data point you'd like to display.
- You can add or remove dimensions in the Dimension section.
- You can change or remove the selected metric in the Metric section. You can select up to one metric.
- You can add or remove filters in the Filters section.
- You can change the sorting of the table in the Sort section.
- In the Select section, select the column and row that contains the data point that you'd like to return. You can also click directly on a cell in the data table to select it.
- Optionally, edit the Font color and Background color settings of the query result chip. The Preview section displays how the chip will look.
- Click Save.
Looker Studio inserts the query result chip into the text element. Whenever a user views this text element, the data value is updated.
Edit and manage query result variables
To edit a query result variable directly from a report page, follow these steps:
- Edit your report.
- Select the text field containing the variable, then click the variable.
- Click the Edit variable icon.
- Make any changes to the query or format of the query result variable.
- Click Save.
To edit a query result variable from a list of all variables, follow these steps:
- Edit your report.
- Click the Resource menu, and then select Manage variables (parameters).
- Next to the query result variable that you'd like to edit, click Edit.
- Make any changes to the query or format of the variable.
- Click Save.
Duplicate a query result variable
To duplicate a query result variable, follow these steps:
- Edit your report.
- Click the Resource menu, and then select Manage variables (parameters).
- Next to the query result variable that you'd like to duplicate, click Duplicate.
- Make any changes to the query or format of the variable.
- Click Save.
Delete a query result variable
To delete a query result variable directly from a report page, follow these steps:
- Edit your report.
- Click or hold the pointer over the query result chip, and then click the Delete icon.
To delete a query result variable from a list of all variables, follow these steps:
- Edit your report.
- Click the Resource menu, and then select Manage variables (parameters).
- Next to the query result variable that you'd like to delete, click Delete.
- In the confirmation dialog, click Remove variable.