Before you begin
Create a dashboard and add the Cognite Data Source for Grafana as a data source.Create a variable from a query
Use the$variable or [[variable]] syntax to create templates.
1
Open variables settings
Navigate to your dashboard’s settings, and select Variables from the left-hand side.
2
Configure the data source
Set Type to Query, and select your Cognite Data Source as the Data source.
3
Enter the query
In the Query field, enter the query to fetch and filter assets from Cognite Data Fusion (CDF).For example, this query requests assets with the parameter
parentIds=[123] and filters the results by name that matches the test-.* regular expression:4
Save the variable
Select Update.
Use data models in variables
Use GraphQL queries against data models to populate variable values from CDF.1
Open the Data models tab
In the variable query editor, select the Data models tab.
2
Select the data model and version
Choose the data model and version you want to query.
3
Write the GraphQL query and select a field
Enter a GraphQL query and select the field to use as the variable values. The selected field should be a scalar value such as an external ID or name. The value field list is populated from your query once it is valid.
Nested (chained) variables
With nested variables, you can create a template to visualize time series related to a branch of the asset subtree and let users navigate the subtree.1
Create nested variables
Create the necessary nested variables.

2
Use the variable as a filter
Use the variable as the asset filter on the dashboard.

Users can choose assets on each level of the hierarchy.
