Menu
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Enterprise
Open source
Add a data source variable
Data source variables allow you to quickly change the data source for an entire dashboard. They are useful if you have multiple instances of a data source, perhaps in different environments.
Enter General options
- Navigate to the dashboard you want to make a variable for and then click the Dashboard settings (gear) icon at the top of the page.
- On the Variables tab, click New.
- Enter a Name for your variable.
- In the Type list, select Datasource.
- (optional) In Label, enter the display name of the variable dropdown. If you don’t enter a display name, then the dropdown label will be the variable name.
- Choose a Hide option:
- No selection (blank) - The variable dropdown displays the variable Name or Label value. This is the default.
- Label - The variable dropdown only displays the selected variable value and a down arrow.
- Variable - No variable dropdown is displayed on the dashboard.
Enter Data source options
- In the Type list, select the target data source for the variable. For more information about data sources, refer to Add a data source.
- (optional) In Instance name filter, enter a regex filter for which data source instances to choose from in the variable value drop-down list. Leave this field empty to display all instances.
- (optional) Enter Selection Options.
- In Preview of values, Grafana displays a list of the current variable values. Review them to ensure they match what you expect.
- Click Add to add the variable to the dashboard.
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:

Getting started with the Grafana LGTM Stack
In this webinar, we’ll demo how to get started using the LGTM Stack: Loki for logs, Grafana for visualization, Tempo for traces, and Mimir for metrics.

Getting started with Grafana dashboard design (EMEA Timezone)
In this webinar, you'll learn how to design stylish and easily accessible Grafana dashboards that tell a story.

Unify your data with Grafana plugins: Datadog, Splunk, MongoDB, and more
In this webinar, learn how to leverage Grafana's plugin ecosystem for access to 80+ data sources, including plugins for Datadog, Splunk, MongoDB, and more.