<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Variables on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/</link><description>Recent content in Variables on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.1/visualizations/dashboards/variables/index.xml" rel="self" type="application/rss+xml"/><item><title>Add variables</title><link>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/add-template-variables/</link><pubDate>Tue, 23 Jun 2026 13:06:40 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/add-template-variables/</guid><content><![CDATA[&lt;h1 id=&#34;add-variables&#34;&gt;Add variables&lt;/h1&gt;
&lt;p&gt;In addition to the built-in global variables that come with Grafana, you can create your own variables.
The following table lists the types of variables you can create:&lt;/p&gt;
&lt;!-- prettier-ignore-start --&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Variable type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Query&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on. &lt;a href=&#34;#add-a-query-variable&#34;&gt;Add a query variable&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Custom&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Define the variable options manually using a comma-separated list. &lt;a href=&#34;#add-a-custom-variable&#34;&gt;Add a custom variable&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Text box&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Display a free text input field with an optional default value. &lt;a href=&#34;#add-a-text-box-variable&#34;&gt;Add a text box variable&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Constant&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Define a hidden constant. &lt;a href=&#34;#add-a-constant-variable&#34;&gt;Add a constant variable&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Data source&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Quickly change the data source for an entire dashboard. &lt;a href=&#34;#add-a-data-source-variable&#34;&gt;Add a data source variable&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Interval&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Interval variables represent time spans. &lt;a href=&#34;#add-an-interval-variable&#34;&gt;Add an interval variable&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Switch&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Display a switch that allows you to toggle between two configurable values for enabled and disabled states. &lt;a href=&#34;#add-a-switch-variable&#34;&gt;Add a switch variable&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;!-- prettier-ignore-end --&gt;
&lt;!-- vale Grafana.WordList = NO --&gt;
&lt;!-- vale Grafana.Spelling = NO --&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;In Grafana 13.1, &lt;strong&gt;Ad hoc filters&lt;/strong&gt; have been renamed &lt;strong&gt;Filter and Group by&lt;/strong&gt; and extended by adding grouping for Prometheus and Loki data sources.
However, in the dashboard schema, they&amp;rsquo;re still referred to as &lt;code&gt;&amp;quot;kind&amp;quot;: &amp;quot;AdhocVariable&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For information on the &lt;strong&gt;Filter and Group by&lt;/strong&gt; feature, refer to the 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/build-dashboards/filter-group-by/&#34;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;!-- vale Grafana.WordList = YES --&gt;
&lt;!-- vale Grafana.Spelling = YES --&gt;
&lt;h2 id=&#34;enter-general-options-for-any-variable&#34;&gt;Enter general options for any variable&lt;/h2&gt;
&lt;p&gt;To create a variable, follow these steps:&lt;/p&gt;
&lt;ol&gt;
    
&lt;li&gt;Click &lt;strong&gt;Edit&lt;/strong&gt; in the top-right corner of the dashboard.&lt;/li&gt;
&lt;li&gt;In the toolbar, click the &lt;strong&gt;Dashboard options&lt;/strong&gt; icon to open the sidebar.&lt;/li&gt;
&lt;li&gt;In the sidebar, click &lt;strong&gt;Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Variables&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add variable&lt;/strong&gt;, or if there are already variables, &lt;strong&gt;&#43; New variable&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose an option in the &lt;strong&gt;Select variable type&lt;/strong&gt; drop-down list.&lt;/li&gt;


&lt;li&gt;
&lt;p&gt;Enter a &lt;strong&gt;Name&lt;/strong&gt; for the variable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) In the &lt;strong&gt;Label&lt;/strong&gt; field, enter the display name for the variable drop-down list.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t enter a display name, then the drop-down list label is the variable name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) In the &lt;strong&gt;Description&lt;/strong&gt; field, enter a description of the variable. The description appears as an info icon tooltip next to the variable name on the dashboard.&lt;/p&gt;
&lt;p&gt;Descriptions support links. You can use Markdown-style links (&lt;code&gt;[link text](https://example.com)&lt;/code&gt;) or paste bare URLs (&lt;code&gt;https://example.com&lt;/code&gt;). Only &lt;code&gt;http&lt;/code&gt; and &lt;code&gt;https&lt;/code&gt; URLs are rendered as clickable links—other protocols are displayed as plain text.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose a &lt;strong&gt;Display&lt;/strong&gt; option:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Above dashboard&lt;/strong&gt; - The variable drop-down list displays above the dashboard with the variable &lt;strong&gt;Name&lt;/strong&gt; or &lt;strong&gt;Label&lt;/strong&gt; value. This is the default.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Above dashboard, label hidden&lt;/strong&gt; - The variable drop-down list displays above the dashboard, but without showing the name of the variable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Controls menu&lt;/strong&gt; - The variable is displayed in the dashboard controls menu instead of above the dashboard. The dashboard controls menu appears as a button in the dashboard toolbar.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hidden&lt;/strong&gt; - No variable drop-down list is displayed on the dashboard.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;


&lt;li&gt;Click one of the following links to complete the steps for adding your selected variable type:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#add-a-query-variable&#34;&gt;Query&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#add-a-custom-variable&#34;&gt;Custom&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#add-a-text-box-variable&#34;&gt;Textbox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#add-a-constant-variable&#34;&gt;Constant&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#add-a-data-source-variable&#34;&gt;Data source&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#add-an-interval-variable&#34;&gt;Interval&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#add-a-switch-variable&#34;&gt;Switch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;


&lt;/ol&gt;

&lt;!-- vale Grafana.Spelling = YES --&gt;


&lt;div class=&#34;admonition admonition-tip&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Tip&lt;/p&gt;&lt;p&gt;To add variables without leaving the dashboard, click the &lt;strong&gt;Add new element&lt;/strong&gt; icon in the dashboard toolbar, and select &lt;strong&gt;Variable&lt;/strong&gt;.
For more information, refer to the 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/build-dashboards/create-dashboard/dashboard-controls/&#34;&gt;Dashboard controls documentation&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;variable-best-practices&#34;&gt;Variable best practices&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Variable drop-down lists are displayed in the order in which they&amp;rsquo;re listed in the &lt;strong&gt;Variables&lt;/strong&gt; tab in dashboard settings, so put the variables that you change often at the top, so they&amp;rsquo;re shown first.&lt;/li&gt;
&lt;li&gt;By default, variables don&amp;rsquo;t have a default value. This means that the topmost value in the drop-down list is always preselected. If you want to pre-populate a variable with an empty value, you can use the following workaround in the variable settings:
&lt;ol&gt;
&lt;li&gt;Select the &lt;strong&gt;Include All Option&lt;/strong&gt; checkbox.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Custom all value&lt;/strong&gt; field, enter a value like &lt;code&gt;.&#43;&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;add-a-query-variable&#34;&gt;Add a query variable&lt;/h2&gt;
&lt;p&gt;Query variables enable you to write a data source query that can return a list of metric names, tag values, or keys. For example, a query variable might return a list of server names, sensor IDs, or data centers. The variable values change as they dynamically fetch options with a data source query.&lt;/p&gt;
&lt;p&gt;Query variables are generally only supported for strings. If your query returns numbers or any other data type, you might need to convert them to strings to use them as variables. For the Azure data source, for example, you can use the &lt;a href=&#34;https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/tostringfunction&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;tostring&lt;/code&gt;&lt;/a&gt; function for this purpose.&lt;/p&gt;
&lt;p&gt;Query expressions can contain references to other variables and in effect create linked variables. Grafana detects this and automatically refreshes a variable when one of its linked variables change.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Query expressions are different for each data source. For more information, refer to the documentation for your 
    &lt;a href=&#34;/docs/grafana/v13.1/datasources/&#34;&gt;data source&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;#enter-general-options-for-any-variable&#34;&gt;Enter general options&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the following options:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Option&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Data source&lt;/td&gt;
              &lt;td&gt;Select a target data source in the &lt;strong&gt;Data source&lt;/strong&gt; drop-down list. You can also click &lt;strong&gt;Open advanced data source picker&lt;/strong&gt; to see more options, including adding a data source (Admins only). For more information about data sources, refer to 
    &lt;a href=&#34;/docs/grafana/v13.1/datasources/#add-a-data-source&#34;&gt;Add a data source&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Query type&lt;/td&gt;
              &lt;td&gt;Select an option in the drop-down list and fill in the query fields accordingly. For more information, refer to the &lt;a href=&#34;#query-type&#34;&gt;Query type&lt;/a&gt; section following these steps.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Regex&lt;/td&gt;
              &lt;td&gt;(Optional) Type a regular expression in the field to filter or capture specific parts of the names returned by your data source query. To see examples, refer to 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/variables/advanced-variables/#filter-variables-with-regex&#34;&gt;Filter variables with a regular expression&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Apply regex to&lt;/td&gt;
              &lt;td&gt;Select &lt;strong&gt;Variable value&lt;/strong&gt; or &lt;strong&gt;Display text&lt;/strong&gt; to choose where the regular expression pattern is applied. The default is &lt;strong&gt;Variable value&lt;/strong&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Sort&lt;/td&gt;
              &lt;td&gt;Select the sort order for values to be displayed in the drop-down list. The default option, &lt;strong&gt;Disabled&lt;/strong&gt;, means that the order of options returned by your data source query is used.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Refresh&lt;/td&gt;
              &lt;td&gt;Select when the variable should update options:&lt;ul&gt;&lt;li&gt;&lt;strong&gt;On dashboard load&lt;/strong&gt; - Queries the data source every time the dashboard loads. This slows down dashboard loading, because the variable query needs to be completed before dashboard can be initialized.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;On time range change&lt;/strong&gt; - Queries the data source every time the dashboard loads and when the dashboard time range changes. Use this option if your variable options query contains a time range filter or is dependent on the dashboard time range.&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Use static options&lt;/td&gt;
              &lt;td&gt;(Optional) Toggle on the switch to add custom options in addition to the query results:&lt;ul&gt;&lt;li&gt;Make entries in the &lt;strong&gt;Value&lt;/strong&gt; and &lt;strong&gt;Display text&lt;/strong&gt; fields.&lt;/li&gt;&lt;li&gt;Click &lt;strong&gt;&#43; Add new option&lt;/strong&gt; to add another static option.&lt;/li&gt;&lt;/ul&gt; Repeat these steps as many times as needed.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Multi-value&lt;/td&gt;
              &lt;td&gt;Enables multiple values to be selected at the same time. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Allow custom values&lt;/td&gt;
              &lt;td&gt;Enables users to add custom values to the list. Only applies to CSV custom values. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Include All option&lt;/td&gt;
              &lt;td&gt;Enables an option to include all variables. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Run query&lt;/strong&gt; to test the variable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Preview of values&lt;/strong&gt; section, Grafana displays a list of the current variable values. Review them to ensure they match what you expect.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; in the top-right corner.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter an optional description of your changes and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Back to list&lt;/strong&gt; to add or edit other variables, or &lt;strong&gt;Back to dashboard&lt;/strong&gt; and then &lt;strong&gt;Exit edit&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;query-type&#34;&gt;Query type&lt;/h3&gt;
&lt;p&gt;The query field varies according to your data source.
Some data sources have custom query editors.&lt;/p&gt;
&lt;p&gt;Each data source defines how the variable values are extracted.
The typical implementation uses every string value returned from the data source response as a variable value.
Make sure to double-check the documentation for the data source.&lt;/p&gt;
&lt;p&gt;Some data sources let you provide custom &amp;ldquo;display names&amp;rdquo; for the values.
For instance, the PostgreSQL, MySQL, and Microsoft SQL Server plugins handle this by looking for fields named &lt;code&gt;__text&lt;/code&gt; and &lt;code&gt;__value&lt;/code&gt; in the result.
Other data sources may look for &lt;code&gt;text&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt; or use a different approach.
Always remember to double-check the documentation for the data source.&lt;/p&gt;
&lt;p&gt;If you need more room in a single input field query editor, then hover your cursor over the lines in the lower right corner of the field and drag downward to expand.&lt;/p&gt;
&lt;h2 id=&#34;add-a-custom-variable&#34;&gt;Add a custom variable&lt;/h2&gt;
&lt;p&gt;Use a &lt;em&gt;custom&lt;/em&gt; variable for a value that doesn&amp;rsquo;t change, such as a number or a string.&lt;/p&gt;
&lt;p&gt;For example, if you have server names or region names that never change, then you might want to create them as custom variables rather than query variables. Because they don&amp;rsquo;t change, you might use them in 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/variables/advanced-variables/#chained-variables&#34;&gt;chained variables&lt;/a&gt; rather than other query variables. That would reduce the number of queries Grafana must send when chained variables are updated.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;#enter-general-options-for-any-variable&#34;&gt;Enter general options&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the following options:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Option&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;CSV&lt;/td&gt;
              &lt;td&gt;Enter a flat list of values for the variable in a comma-separated list. You can include numbers, strings, or key/value pairs separated by a space and a colon. For example, &lt;code&gt;key1 : value1,key2 : value2&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;JSON&lt;/td&gt;
              &lt;td&gt;Provide a JSON array of objects where each object can have any number of properties that can be referenced. For more information refer, to 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/variables/advanced-variables/#multi-property-variables&#34;&gt;Configure multi-property variables&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Multi-value&lt;/td&gt;
              &lt;td&gt;Enables multiple values to be selected at the same time. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Allow custom values&lt;/td&gt;
              &lt;td&gt;Enables users to add custom values to the list. Only applies to CSV custom values. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Include All option&lt;/td&gt;
              &lt;td&gt;Enables an option to include all variables. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Run query&lt;/strong&gt; to test the variable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Preview of values&lt;/strong&gt; section, Grafana displays a list of the current variable values. If you&amp;rsquo;ve entered a JSON array, the preview is a table that includes all the value properties. Review them to ensure they match what you expect.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; in the top-right corner.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter an optional description of your changes and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Back to list&lt;/strong&gt; to add or edit other variables, or &lt;strong&gt;Back to dashboard&lt;/strong&gt; and then &lt;strong&gt;Exit edit&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;add-a-text-box-variable&#34;&gt;Add a text box variable&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Text box&lt;/em&gt; variables display a free text input field with an optional default value. This is the most flexible variable, because you can enter any value. Use this type of variable if you have metrics with high cardinality or if you want to update multiple panels in a dashboard at the same time.&lt;/p&gt;
&lt;p&gt;For more information about cardinality, refer to &lt;a href=&#34;/blog/2022/02/15/what-are-cardinality-spikes-and-why-do-they-matter/&#34;&gt;What are cardinality spikes and why do they matter?&lt;/a&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;#enter-general-options-for-any-variable&#34;&gt;Enter general options&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) Under the &lt;strong&gt;Text options&lt;/strong&gt; section of the page, in the &lt;strong&gt;Default value&lt;/strong&gt; field, enter the default value for the variable.&lt;/p&gt;
&lt;p&gt;If you do not enter anything in this field, then Grafana displays an empty text box for users to type text into.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; in the top-right corner.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter an optional description of your changes and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Back to list&lt;/strong&gt; to add or edit other variables, or &lt;strong&gt;Back to dashboard&lt;/strong&gt; and then &lt;strong&gt;Exit edit&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;add-a-constant-variable&#34;&gt;Add a constant variable&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Constant&lt;/em&gt; variables enable you to define a hidden constant. This is useful for metric path prefixes for dashboards you want to share. When you export a dashboard, constant variables are converted to import options.&lt;/p&gt;
&lt;p&gt;Constant variables are &lt;em&gt;not&lt;/em&gt; flexible. Each constant variable only holds one value, and it cannot be updated unless you update the variable settings.&lt;/p&gt;
&lt;p&gt;Constant variables are useful when you have complex values that you need to include in queries but don&amp;rsquo;t want to retype in every query. For example, if you had a server path called &lt;code&gt;i-0b6a61efe2ab843gg&lt;/code&gt;, then you could replace it with a variable called &lt;code&gt;$path_gg&lt;/code&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;#enter-general-options-for-any-variable&#34;&gt;Enter general options&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under the &lt;strong&gt;Constant options&lt;/strong&gt; section of the page, in the &lt;strong&gt;Value&lt;/strong&gt; field, enter the variable value.&lt;/p&gt;
&lt;p&gt;You can enter letters, numbers, and symbols. You can even use wildcards if you use 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/variables/variable-syntax/#raw&#34;&gt;raw format&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; in the top-right corner.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter an optional description of your changes and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Back to list&lt;/strong&gt; to add or edit other variables, or &lt;strong&gt;Back to dashboard&lt;/strong&gt; and then &lt;strong&gt;Exit edit&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;add-a-data-source-variable&#34;&gt;Add a data source variable&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Data source&lt;/em&gt; variables enable you to quickly change the data source for an entire dashboard. They&amp;rsquo;re useful if you have multiple instances of a data source, perhaps in different environments.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;#enter-general-options-for-any-variable&#34;&gt;Enter general options&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the following options:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Option&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Type&lt;/td&gt;
              &lt;td&gt;Select the target data source for the variable.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Instance name filter&lt;/td&gt;
              &lt;td&gt;(Optional) Enter a regular expression filter for which data source instances to choose from in the variable value drop-down list. Leave this field empty to display all instances.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Multi-value&lt;/td&gt;
              &lt;td&gt;Enables multiple values to be selected at the same time. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Allow custom values&lt;/td&gt;
              &lt;td&gt;Enables users to add custom values to the list. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Include All option&lt;/td&gt;
              &lt;td&gt;Enables an option to include all variables. For more information, refer to &lt;a href=&#34;#configure-variable-selection-options&#34;&gt;Selection Options&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Run query&lt;/strong&gt; to test the variable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Preview of values&lt;/strong&gt; section, Grafana displays a list of the current variable values. Review them to ensure they match what you expect.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; in the top-right corner.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter an optional description of your changes and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Back to list&lt;/strong&gt; to add or edit other variables, or &lt;strong&gt;Back to dashboard&lt;/strong&gt; and then &lt;strong&gt;Exit edit&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;add-an-interval-variable&#34;&gt;Add an interval variable&lt;/h2&gt;
&lt;p&gt;Use an &lt;em&gt;interval&lt;/em&gt; variable to represents time spans such as &lt;code&gt;1m&lt;/code&gt;,&lt;code&gt;1h&lt;/code&gt;, &lt;code&gt;1d&lt;/code&gt;. You can think of them as a dashboard-wide &amp;ldquo;group by time&amp;rdquo; command. Interval variables change how the data is grouped in the visualization. You can also use the Auto Option to return a set number of data points per time span.&lt;/p&gt;
&lt;p&gt;You can use an interval variable as a parameter to group by time (for InfluxDB), date histogram interval (for Elasticsearch), or as a summarize function parameter (for Graphite).&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;#enter-general-options-for-any-variable&#34;&gt;Enter general options&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the following options:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Option&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Values&lt;/td&gt;
              &lt;td&gt;Enter the time range intervals that you want to appear in the variable drop-down list. The following time units are supported: &lt;code&gt;s (seconds)&lt;/code&gt;, &lt;code&gt;m (minutes)&lt;/code&gt;, &lt;code&gt;h (hours)&lt;/code&gt;, &lt;code&gt;d (days)&lt;/code&gt;, &lt;code&gt;w (weeks)&lt;/code&gt;, &lt;code&gt;M (months)&lt;/code&gt;, and &lt;code&gt;y (years)&lt;/code&gt;. You can also accept or edit the default values: &lt;code&gt;1m,10m,30m,1h,6h,12h,1d,7d,14d,30d&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Auto option&lt;/td&gt;
              &lt;td&gt;(Optional) Select on the checkbox if you want to add the &lt;code&gt;auto&lt;/code&gt; option to the list. This option allows you to specify how many times the current time range should be divided to calculate the current &lt;code&gt;auto&lt;/code&gt; time span.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Step count&lt;/td&gt;
              &lt;td&gt;Select the number of times the current time range is divided to calculate the value, similar to the &lt;strong&gt;Max data points&lt;/strong&gt; query option. For example, if the current visible time range is 30 minutes, then the &lt;code&gt;auto&lt;/code&gt; interval groups the data into 30 one-minute increments. The default value is 30 steps. Only displayed when you select the &lt;strong&gt;Auto option&lt;/strong&gt; checkbox.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Min interval&lt;/td&gt;
              &lt;td&gt;The minimum threshold below which the step count intervals doesn&amp;rsquo;t divide the time. To continue the 30 minute example, if the minimum interval is set to 2m, then Grafana would group the data into 15 two-minute increments. Only displayed when you select the &lt;strong&gt;Auto option&lt;/strong&gt; checkbox.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Run query&lt;/strong&gt; to test the variable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Preview of values&lt;/strong&gt; section, Grafana displays a list of the current variable values. Review them to ensure they match what you expect.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; in the top-right corner.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter an optional description of your changes and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Back to list&lt;/strong&gt; to add or edit other variables, or &lt;strong&gt;Back to dashboard&lt;/strong&gt; and then &lt;strong&gt;Exit edit&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;interval-variable-examples&#34;&gt;Interval variable examples&lt;/h3&gt;
&lt;p&gt;The following example shows a template variable &lt;code&gt;myinterval&lt;/code&gt; in a Graphite function:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;summarize($myinterval, sum, false)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following example shows a more complex Graphite example, from the &lt;a href=&#34;https://play.grafana.org/d/000000056/graphite-templated-nested?editPanel=2&amp;amp;orgId=1&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Graphite Template Nested Requests panel&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;groupByNode(summarize(movingAverage(apps.$app.$server.counters.requests.count, 5), &amp;#39;$interval&amp;#39;, &amp;#39;sum&amp;#39;, false), 2, &amp;#39;sum&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;add-a-switch-variable&#34;&gt;Add a switch variable&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Switch&lt;/em&gt; variables display a switch with two configurable values representing enabled and disabled states. This variable type is useful when you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Toggle between different query conditions&lt;/li&gt;
&lt;li&gt;Enable or disable specific filters&lt;/li&gt;
&lt;li&gt;Switch between different visualization modes&lt;/li&gt;
&lt;li&gt;Control boolean parameters in your data sources&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;#enter-general-options-for-any-variable&#34;&gt;Enter general options&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the following options:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Option&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Value pair type&lt;/td&gt;
              &lt;td&gt;Select one of the following predefined options:&lt;ul&gt;&lt;li&gt;&lt;strong&gt;True / False&lt;/strong&gt; - Uses boolean values &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;1 / 0&lt;/strong&gt; - Uses numeric values &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Yes / No&lt;/strong&gt; - Uses string values &lt;code&gt;yes&lt;/code&gt; and &lt;code&gt;no&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Custom&lt;/strong&gt; - Allows you to define custom values for both enabled and disabled states.&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Enabled value&lt;/td&gt;
              &lt;td&gt;If you selected &lt;strong&gt;Custom&lt;/strong&gt;, configure the custom values. Enter the value that represents the enabled state (for example, &amp;ldquo;on&amp;rdquo;).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Disabled value&lt;/td&gt;
              &lt;td&gt;If you selected &lt;strong&gt;Custom&lt;/strong&gt;, enter the value that represents the disabled state (for example, &amp;ldquo;off&amp;rdquo;).&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save dashboard&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Back to list&lt;/strong&gt; to add or edit other variables, or &lt;strong&gt;Back to dashboard&lt;/strong&gt; and then &lt;strong&gt;Exit edit&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;switch-variable-examples&#34;&gt;Switch variable examples&lt;/h3&gt;
&lt;p&gt;The following example shows a switch variable &lt;code&gt;$debug_mode&lt;/code&gt; used in a Prometheus query to conditionally include debug labels:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;up{job=&amp;#34;my-service&amp;#34;} and ($debug_mode == &amp;#34;true&amp;#34; or on() vector(0))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following example shows a switch variable &lt;code&gt;$show_errors&lt;/code&gt; used to filter log entries:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;{job=&amp;#34;application&amp;#34;} |= ($show_errors == &amp;#34;1&amp;#34; ? &amp;#34;ERROR&amp;#34; : &amp;#34;&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also use switch variables in panel titles and other dashboard elements:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;{{#if debug_mode}}Debug Mode: {{/if}}Application Metrics&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- vale Grafana.Spelling = YES --&gt;
&lt;!-- vale Grafana.WordList = YES --&gt;
&lt;h2 id=&#34;configure-variable-selection-options&#34;&gt;Variable selection options&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Selection Options&lt;/strong&gt; are a feature you can use to manage variable option selections for query and custom variables. All selection options are optional, and they&amp;rsquo;re off by default.&lt;/p&gt;
&lt;h3 id=&#34;multi-value-variables&#34;&gt;Multi-value variables&lt;/h3&gt;
&lt;p&gt;Interpolating a variable with multiple values selected is tricky as it&amp;rsquo;s not straight forward how to format the multiple values into a string that&amp;rsquo;s valid in the given context where the variable is used. Grafana tries to solve this by allowing each data source plugin to inform the templating interpolation engine what format to use for multiple values.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The &lt;strong&gt;Custom all value&lt;/strong&gt; option on the variable must be blank for Grafana to format all values into a single string. If it&amp;rsquo;s left blank, then Grafana concatenates (adds together) all the values in the query. Something like &lt;code&gt;value1,value2,value3&lt;/code&gt;. If a custom &lt;code&gt;all&lt;/code&gt; value is used, then instead the value is something like &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;all&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h4 id=&#34;multi-value-variables-with-a-graphite-data-source&#34;&gt;Multi-value variables with a Graphite data source&lt;/h4&gt;
&lt;p&gt;Graphite uses glob expressions. A variable with multiple values would, in this case, be interpolated as &lt;code&gt;{host1,host2,host3}&lt;/code&gt; if the current variable value was &lt;em&gt;host1&lt;/em&gt;, &lt;em&gt;host2&lt;/em&gt;, and &lt;em&gt;host3&lt;/em&gt;.&lt;/p&gt;
&lt;h4 id=&#34;multi-value-variables-with-a-prometheus-or-influxdb-data-source&#34;&gt;Multi-value variables with a Prometheus or InfluxDB data source&lt;/h4&gt;
&lt;p&gt;InfluxDB and Prometheus use regular expressions, so the same variable would be interpolated as &lt;code&gt;(host1|host2|host3)&lt;/code&gt;. Every value would also be regular expression escaped. If not, a value with a regular expression control character would break the regular expression.&lt;/p&gt;
&lt;h4 id=&#34;multi-value-variables-with-an-elastic-data-source&#34;&gt;Multi-value variables with an Elastic data source&lt;/h4&gt;
&lt;p&gt;Elasticsearch uses Lucene query syntax, so the same variable would be formatted as &lt;code&gt;(&amp;quot;host1&amp;quot; OR &amp;quot;host2&amp;quot; OR &amp;quot;host3&amp;quot;)&lt;/code&gt;. In this case, every value must be escaped so that the value only contains Lucene control words and quotation marks.&lt;/p&gt;
&lt;h4 id=&#34;variable-indexing&#34;&gt;Variable indexing&lt;/h4&gt;
&lt;p&gt;If you have a multi-value variable that&amp;rsquo;s formatted as an array, you can use array positions to reference the values rather than the actual values.
You can use this functionality in dashboard panels to filter data, and when you do so, the array is maintained.&lt;/p&gt;
&lt;p&gt;To reference variable values this way, use the following syntax:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;${query0.0}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The preceding syntax references the first, or &lt;code&gt;0&lt;/code&gt;, position in the array.&lt;/p&gt;
&lt;p&gt;In the following example, there&amp;rsquo;s an array of three values, &lt;code&gt;1t&lt;/code&gt;, &lt;code&gt;2t&lt;/code&gt;, and &lt;code&gt;3t&lt;/code&gt;, and rather than referencing those values, the panel query references the second value in the array using the syntax &lt;code&gt;${query0.1}&lt;/code&gt;:&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 750px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png&#34;data-srcset=&#34;/media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png?w=320 320w, /media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png?w=550 550w, /media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png?w=750 750w, /media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png?w=900 900w, /media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png?w=1040 1040w, /media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png?w=1240 1240w, /media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Panel query using variable indexing to reference a value&#34;width=&#34;2362&#34;height=&#34;1258&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/grafana/dashboards/screenshot-indexed-variables-v12.1.png&#34;
            alt=&#34;Panel query using variable indexing to reference a value&#34;width=&#34;2362&#34;height=&#34;1258&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h4 id=&#34;troubleshoot-multi-value-variables&#34;&gt;Troubleshoot multi-value variables&lt;/h4&gt;
&lt;p&gt;Automatic escaping and formatting can cause problems and it can be tricky to grasp the logic behind it. Especially for InfluxDB and Prometheus where the use of regular expression syntax requires that the variable is used in regular expression operator context.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t want Grafana to do this automatic regular expression escaping and formatting, then you must do one of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Turn off the &lt;strong&gt;Multi-value&lt;/strong&gt; or &lt;strong&gt;Include All option&lt;/strong&gt; options.&lt;/li&gt;
&lt;li&gt;Use the 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/variables/variable-syntax/#raw&#34;&gt;raw variable format&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;custom-all-value&#34;&gt;Custom all value&lt;/h3&gt;
&lt;p&gt;This option is only visible if the &lt;strong&gt;Include All option&lt;/strong&gt; is selected.&lt;/p&gt;
&lt;p&gt;Enter regular expressions, globs, or Lucene syntax in the &lt;strong&gt;Custom all value&lt;/strong&gt; field to define the value of the &lt;code&gt;All&lt;/code&gt; option.&lt;/p&gt;
&lt;p&gt;By default the &lt;code&gt;All&lt;/code&gt; value includes all options in combined expression. This can become very long and can have performance problems. Sometimes it can be better to specify a custom all value, like a wildcard regular expression.&lt;/p&gt;
&lt;p&gt;In order to have custom regular expression, globs, or Lucene syntax in the &lt;strong&gt;Custom all value&lt;/strong&gt; option, it&amp;rsquo;s never escaped so you have to think about what&amp;rsquo;s a valid value for your data source.&lt;/p&gt;
&lt;h3 id=&#34;include-all-option&#34;&gt;Include All option&lt;/h3&gt;
&lt;p&gt;Grafana adds an &lt;code&gt;All&lt;/code&gt; option to the variable drop-down list. If a user selects this option, then all variable options are selected.&lt;/p&gt;
]]></content><description>&lt;h1 id="add-variables">Add variables&lt;/h1>
&lt;p>In addition to the built-in global variables that come with Grafana, you can create your own variables.
The following table lists the types of variables you can create:&lt;/p></description></item><item><title>Global variables</title><link>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/global-variables/</link><pubDate>Tue, 23 Jun 2026 13:06:40 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/global-variables/</guid><content><![CDATA[&lt;h1 id=&#34;global-variables&#34;&gt;Global variables&lt;/h1&gt;
&lt;p&gt;Grafana has global built-in variables that can be used in expressions in the query editor.
This page lists them in alphabetical order and defines them.
Most variables are useful in queries, dashboard links, panel links, and data links — but some, like &lt;code&gt;$__url_time_range&lt;/code&gt;, are intended only for use in links, not query editors.&lt;/p&gt;
&lt;h2 id=&#34;__dashboard&#34;&gt;&lt;code&gt;$__dashboard&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This variable is the name of the current dashboard.&lt;/p&gt;
&lt;h2 id=&#34;__from-and-__to&#34;&gt;&lt;code&gt;$__from&lt;/code&gt; and &lt;code&gt;$__to&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Grafana has built-in time range variables: &lt;code&gt;$__from&lt;/code&gt; and &lt;code&gt;$__to&lt;/code&gt;.
They&amp;rsquo;re always interpolated as epoch milliseconds by default, but you can control date formatting.&lt;/p&gt;
&lt;!-- prettier-ignore-start --&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Syntax&lt;/th&gt;
              &lt;th&gt;Example result&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;${__from}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;1594671549254&lt;/td&gt;
              &lt;td&gt;Unix millisecond epoch&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;${__from:date}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;2020-07-13T20:19:09.254Z&lt;/td&gt;
              &lt;td&gt;No arguments, defaults to ISO 8601/RFC 3339&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;${__from:date:iso}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;2020-07-13T20:19:09.254Z&lt;/td&gt;
              &lt;td&gt;ISO 8601/RFC 3339&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;${__from:date:seconds}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;1594671549&lt;/td&gt;
              &lt;td&gt;Unix seconds epoch&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;${__from:date:YYYY-MM}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;2020-07&lt;/td&gt;
              &lt;td&gt;Any custom &lt;a href=&#34;https://momentjs.com/docs/#/displaying/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;date format&lt;/a&gt; that doesn&amp;rsquo;t include the &lt;code&gt;:&lt;/code&gt; character. Uses browser time. Use &lt;code&gt;:date&lt;/code&gt; or &lt;code&gt;:date:iso&lt;/code&gt; for UTC&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;!-- prettier-ignore-end --&gt;
&lt;p&gt;The syntax above also works with &lt;code&gt;${__to}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can use this variable in URLs, as well. For example, you can send a user to a dashboard that shows a time range from six hours ago until now: &lt;code&gt;https://play.grafana.org/d/000000012/grafana-play-home?viewPanel=2&amp;amp;orgId=1?from=now-6h&amp;amp;to=now&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;__interval&#34;&gt;&lt;code&gt;$__interval&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;You can use the &lt;code&gt;$__interval&lt;/code&gt; variable as a parameter to group by time (for InfluxDB, MySQL, Postgres, MSSQL), Date histogram interval (for Elasticsearch), or as a &lt;em&gt;summarize&lt;/em&gt; function parameter (for Graphite).&lt;/p&gt;
&lt;p&gt;Grafana automatically calculates an interval that can be used to group by time in queries. When there are more data points than can be shown on a graph, then queries can be made more efficient by grouping by a larger interval. It&amp;rsquo;s more efficient to group by 1 day than by 10s when looking at 3 months of data. The graph looks the same and the query is faster. The &lt;code&gt;$__interval&lt;/code&gt; is calculated using the time range and the width of the graph (the number of pixels).&lt;/p&gt;
&lt;p&gt;Approximate Calculation: &lt;code&gt;(to - from) / resolution&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For example, when the time range is 1 hour and the graph is full screen, then the interval might be calculated to &lt;code&gt;2m&lt;/code&gt; - points are grouped in 2 minute intervals. If the time range is 6 months and the graph is full screen, then the interval might be &lt;code&gt;1d&lt;/code&gt; (1 day) - points are grouped by day.&lt;/p&gt;
&lt;p&gt;In the InfluxDB data source, the legacy variable &lt;code&gt;$interval&lt;/code&gt; is the same variable. &lt;code&gt;$__interval&lt;/code&gt; should be used instead.&lt;/p&gt;
&lt;p&gt;The InfluxDB and Elasticsearch data sources have &lt;code&gt;Group by time interval&lt;/code&gt; fields that are used to hard code the interval or to set the minimum limit for the &lt;code&gt;$__interval&lt;/code&gt; variable (by using the &lt;code&gt;&amp;gt;&lt;/code&gt; syntax -&amp;gt; &lt;code&gt;&amp;gt;10m&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&#34;__interval_ms&#34;&gt;&lt;code&gt;$__interval_ms&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This variable is the &lt;code&gt;$__interval&lt;/code&gt; variable in milliseconds, not a time interval formatted string. For example, if the &lt;code&gt;$__interval&lt;/code&gt; is &lt;code&gt;20m&lt;/code&gt; then the &lt;code&gt;$__interval_ms&lt;/code&gt; is &lt;code&gt;1200000&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;__name&#34;&gt;&lt;code&gt;$__name&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This variable is only available in the &lt;strong&gt;Singlestat&lt;/strong&gt; panel and can be used in the prefix or suffix fields on the Options tab. The variable is replaced with the series name or alias.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The &lt;strong&gt;Singlestat&lt;/strong&gt; panel is no longer available from Grafana 8.0.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;__org&#34;&gt;&lt;code&gt;$__org&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This variable is the ID of the current organization.
&lt;code&gt;${__org.name}&lt;/code&gt; is the name of the current organization.&lt;/p&gt;
&lt;h2 id=&#34;__user&#34;&gt;&lt;code&gt;$__user&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;${__user.id}&lt;/code&gt; is the ID of the current user.
&lt;code&gt;${__user.login}&lt;/code&gt; is the login handle of the current user.
&lt;code&gt;${__user.email}&lt;/code&gt; is the email for the current user.&lt;/p&gt;
&lt;h2 id=&#34;__range&#34;&gt;&lt;code&gt;$__range&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Currently only supported for Prometheus and Loki data sources. This variable represents the range for the current dashboard. It&amp;rsquo;s calculated by &lt;code&gt;to - from&lt;/code&gt;. It has a millisecond and a second representation called &lt;code&gt;$__range_ms&lt;/code&gt; and &lt;code&gt;$__range_s&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;__rate_interval&#34;&gt;&lt;code&gt;$__rate_interval&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Currently only supported for Prometheus data sources. The &lt;code&gt;$__rate_interval&lt;/code&gt; variable is meant to be used in the rate function. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.1/datasources/prometheus/template-variables/#use-__rate_interval&#34;&gt;Prometheus query variables&lt;/a&gt; for details.&lt;/p&gt;
&lt;h2 id=&#34;__rate_interval_ms&#34;&gt;&lt;code&gt;$__rate_interval_ms&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;This variable is the &lt;code&gt;$__rate_interval&lt;/code&gt; variable in milliseconds, not a time-interval-formatted string. For example, if the &lt;code&gt;$__rate_interval&lt;/code&gt; is &lt;code&gt;20m&lt;/code&gt; then the &lt;code&gt;$__rate_interval_ms&lt;/code&gt; is &lt;code&gt;1200000&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;timefilter-or-__timefilter&#34;&gt;&lt;code&gt;$timeFilter&lt;/code&gt; or &lt;code&gt;$__timeFilter&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;$timeFilter&lt;/code&gt; variable returns the currently selected time range as an expression. For example, the time range interval &lt;code&gt;Last 7 days&lt;/code&gt; expression is &lt;code&gt;time &amp;gt; now() - 7d&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This is used in several places, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The WHERE clause for the InfluxDB data source. Grafana adds it automatically to InfluxDB queries when in Query Editor mode. You can add it manually in Text Editor mode: &lt;code&gt;WHERE $timeFilter&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Log Analytics queries in the Azure Monitor data source.&lt;/li&gt;
&lt;li&gt;SQL queries in MySQL, Postgres, and MSSQL.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;$__timeFilter&lt;/code&gt; variable is used in the MySQL data source.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;__timezone&#34;&gt;&lt;code&gt;$__timezone&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;$__timezone&lt;/code&gt; variable returns the currently selected time zone, either &lt;code&gt;utc&lt;/code&gt; or an entry of the IANA time zone database (for example, &lt;code&gt;America/New_York&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;If the currently selected time zone is &lt;em&gt;Browser Time&lt;/em&gt;, Grafana tries to determine your browser time zone.&lt;/p&gt;
&lt;h2 id=&#34;__url_time_range&#34;&gt;&lt;code&gt;$__url_time_range&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;$__url_time_range&lt;/code&gt; variable returns the current dashboard time range as URL query parameters.
It&amp;rsquo;s intended for use in data links and panel links, not in query editors.&lt;/p&gt;
&lt;p&gt;The variable expands to a string like &lt;code&gt;from=1607687293000&amp;amp;to=1607687293100&lt;/code&gt;, where the values are Unix millisecond timestamps matching the current time range selection.&lt;/p&gt;
&lt;p&gt;You must include the &lt;code&gt;?&lt;/code&gt; or &lt;code&gt;&amp;amp;&lt;/code&gt; separator yourself when constructing URLs:&lt;/p&gt;
&lt;!-- prettier-ignore-start --&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Usage&lt;/th&gt;
              &lt;th&gt;Example result&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;https://example.com/d/abc?${__url_time_range}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;https://example.com/d/abc?from=1594671549254&amp;amp;to=1594672349254&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;https://example.com/d/abc?orgId=1&amp;amp;${__url_time_range}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;https://example.com/d/abc?orgId=1&amp;amp;from=1594671549254&amp;amp;to=1594672349254&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;!-- prettier-ignore-end --&gt;
&lt;p&gt;To link to another dashboard while preserving the current time range, follow this pattern:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;https://your-grafana/d/other-dashboard?${__url_time_range}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To also pass a variable value from the current dashboard, follow this pattern:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;https://your-grafana/d/other-dashboard?{__url_time_range}&amp;amp;var-host= {host}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;&lt;code&gt;$__url_time_range&lt;/code&gt; always uses Unix millisecond epoch timestamps.
To include only the start or end of the time range with specific formatting, use &lt;a href=&#34;#__from-and-__to&#34;&gt;&lt;code&gt;$__from&lt;/code&gt; and &lt;code&gt;$__to&lt;/code&gt; variables&lt;/a&gt; instead.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

]]></content><description>&lt;h1 id="global-variables">Global variables&lt;/h1>
&lt;p>Grafana has global built-in variables that can be used in expressions in the query editor.
This page lists them in alphabetical order and defines them.
Most variables are useful in queries, dashboard links, panel links, and data links — but some, like &lt;code>$__url_time_range&lt;/code>, are intended only for use in links, not query editors.&lt;/p></description></item><item><title>Advanced variable configurations</title><link>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/advanced-variables/</link><pubDate>Tue, 23 Jun 2026 13:06:40 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/advanced-variables/</guid><content><![CDATA[&lt;h1 id=&#34;advanced-variable-configurations&#34;&gt;Advanced variable configurations&lt;/h1&gt;
&lt;p&gt;The advanced variable configurations described on this page help you build dashboards that adapt to complex data structures and user selections:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Multi-property variables&lt;/strong&gt;: Map one logical value to multiple source-specific values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chained variables&lt;/strong&gt;: Update the options in one variable based on the selections in another.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Regular expression filtering&lt;/strong&gt;: Filter the values returned by a variable query.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These configurations are useful for dashboards that span multiple environments, data sources, regions, clusters, namespaces, or other hierarchical data.&lt;/p&gt;
&lt;h2 id=&#34;multi-property-variables&#34;&gt;Multi-property variables&lt;/h2&gt;
&lt;p&gt;If a multi-source dashboard uses multiple values for the same logical concept, such as an environment identified as &lt;code&gt;dev&lt;/code&gt; in one source and &lt;code&gt;development&lt;/code&gt; in another, use a multi-property variable to reference those values from one variable. This lets you map related identifiers together and reference the property you need in panels and queries.&lt;/p&gt;
&lt;p&gt;To do so, configure a JSON array in which each object can have any number of properties.
Then, you can reference any of the properties as you use those variables.&lt;/p&gt;
&lt;p&gt;This applies to the following variable types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Custom&lt;/li&gt;
&lt;li&gt;Query
&lt;ul&gt;
&lt;li&gt;Infinity&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- add links to data source docs --&gt;
&lt;h3 id=&#34;multi-property-custom-variables&#34;&gt;Multi-property custom variables&lt;/h3&gt;
&lt;p&gt;To create a custom variable with multiple properties, define a JSON array, like this:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;[
  { &amp;#34;value&amp;#34;: &amp;#34;1&amp;#34;, &amp;#34;text&amp;#34;: &amp;#34;Development&amp;#34;, &amp;#34;aws&amp;#34;: &amp;#34;dev&amp;#34;, &amp;#34;azure&amp;#34;: &amp;#34;development&amp;#34;, &amp;#34;google&amp;#34;: &amp;#34;googledev&amp;#34; },
  { &amp;#34;value&amp;#34;: &amp;#34;2&amp;#34;, &amp;#34;text&amp;#34;: &amp;#34;Staging&amp;#34;, &amp;#34;aws&amp;#34;: &amp;#34;stag&amp;#34;, &amp;#34;azure&amp;#34;: &amp;#34;staging&amp;#34;, &amp;#34;google&amp;#34;: &amp;#34;googlestag&amp;#34; },
  { &amp;#34;value&amp;#34;: &amp;#34;3&amp;#34;, &amp;#34;text&amp;#34;: &amp;#34;Production&amp;#34;, &amp;#34;aws&amp;#34;: &amp;#34;prod&amp;#34;, &amp;#34;azure&amp;#34;: &amp;#34;production&amp;#34;, &amp;#34;google&amp;#34;: &amp;#34;googleprod&amp;#34; }
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This is how those values are displayed in a preview:&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 600px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png&#34;data-srcset=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png?w=320 320w, /media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png?w=550 550w, /media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png?w=750 750w, /media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png?w=900 900w, /media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png?w=1040 1040w, /media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png?w=1240 1240w, /media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Custom variable configuration and preview of values&#34;width=&#34;1500&#34;height=&#34;1054&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-preview-vals-v12.4.png&#34;
            alt=&#34;Custom variable configuration and preview of values&#34;width=&#34;1500&#34;height=&#34;1054&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Then you can use &lt;code&gt;${varName.someProperty}&lt;/code&gt; syntax to reference any property in your dashboard panels or metrics:&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 750px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png&#34;data-srcset=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png?w=320 320w, /media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png?w=550 550w, /media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png?w=750 750w, /media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png?w=900 900w, /media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png?w=1040 1040w, /media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png?w=1240 1240w, /media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Multi-property variable used in a text panel&#34;width=&#34;2196&#34;height=&#34;1466&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-used-12.4.png&#34;
            alt=&#34;Multi-property variable used in a text panel&#34;width=&#34;2196&#34;height=&#34;1466&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;You can even deeply nest properties and still access them using familiar variable syntax. In the following example, each user has an address property with all the elements of an address nested within it:&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 650px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png&#34;data-srcset=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png?w=320 320w, /media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png?w=550 550w, /media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png?w=750 750w, /media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png?w=900 900w, /media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png?w=1040 1040w, /media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png?w=1240 1240w, /media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Nested variable configuration&#34;width=&#34;1498&#34;height=&#34;1214&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/grafana/dashboards/screenshot-multipropvar-nested-v12.4.png&#34;
            alt=&#34;Nested variable configuration&#34;width=&#34;1498&#34;height=&#34;1214&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h3 id=&#34;multi-property-query-variables&#34;&gt;Multi-property query variables&lt;/h3&gt;
&lt;p&gt;Because query configuration is different for each data source, there&amp;rsquo;s no one way to set up a JSON array to create a multi-property query variable.
For PostgreSQL, refer to 
    &lt;a href=&#34;/docs/grafana/v13.1/datasources/postgres/template-variables/&#34;&gt;PostgreSQL template variables&lt;/a&gt;.
For other data sources, refer to the relevant 
    &lt;a href=&#34;/docs/grafana/v13.1/datasources/&#34;&gt;Data sources documentation&lt;/a&gt; for preinstalled data source plugins.
For configuration information on all other data source plugins, refer to the &lt;a href=&#34;/docs/plugins/&#34;&gt;Plugins documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;chained-variables&#34;&gt;Chained variables&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Chained variables&lt;/em&gt;, also called &lt;em&gt;linked variables&lt;/em&gt; or &lt;em&gt;nested variables&lt;/em&gt;, are query variables with one or more other variables in their variable query.&lt;/p&gt;
&lt;p&gt;Chained variables create dependent relationships where the options available in one variable depend on the selections made in another.
This pattern enables cascading filters that help users drill down through hierarchical data structures.&lt;/p&gt;
&lt;p&gt;Cascading filter patterns are common in multi-tier filtering scenarios such as region &amp;gt; cluster &amp;gt; namespace &amp;gt; pod.
Each level narrows the available options based on the previous selection, creating an intuitive navigation experience through your infrastructure or data hierarchy.&lt;/p&gt;
&lt;p&gt;Technically, there is no limit to how many variables you can chain together, but the more links you have, the greater the query load.&lt;/p&gt;
&lt;h3 id=&#34;grafana-play-dashboard-examples&#34;&gt;Grafana Play dashboard examples&lt;/h3&gt;
&lt;!-- If you update or replace the Play dashboards linked in this section, you must also update the text examples to match them --&gt;
&lt;p&gt;The following Grafana Play dashboards contain basic chained variables, only two layers deep. To view the variables and their settings, click &lt;strong&gt;Edit&lt;/strong&gt;
and then &lt;strong&gt;Settings&lt;/strong&gt;; then go to the &lt;strong&gt;Variables&lt;/strong&gt; tab. Both examples are expanded in the following section.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://play.grafana.org/d/000000056/graphite-templated-nested?orgId=1&amp;amp;var-app=country&amp;amp;var-server=All&amp;amp;var-interval=1h&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Graphite Templated Nested&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://play.grafana.org/d/e7bad3ef-db0c-4bbd-8245-b85c0b2ca2b9/influx-2-73a-hourly-electric-grid-monitor-for-us?orgId=1&amp;amp;refresh=1m&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB Templated&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While the examples are data source-specific, the concepts can be applied broadly.&lt;/p&gt;
&lt;h4 id=&#34;graphite-example-explained&#34;&gt;Graphite example explained&lt;/h4&gt;
&lt;p&gt;In this example, there are several applications. Each application has a different subset of servers. It&amp;rsquo;s based on the &lt;a href=&#34;https://play.grafana.org/d/000000056/graphite-templated-nested?orgId=1&amp;amp;var-app=country&amp;amp;var-server=All&amp;amp;var-interval=1h&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Graphite Templated Nested&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now, you could make separate variables for each metric source, but then you have to know which server goes with which app. A better solution is to use one variable to filter another. In this example, when the user changes the value of the &lt;code&gt;app&lt;/code&gt; variable, it changes the drop-down options returned by the &lt;code&gt;server&lt;/code&gt; variable. Both variables use the &lt;strong&gt;Multi-value&lt;/strong&gt; option and &lt;strong&gt;Include all option&lt;/strong&gt;, enabling users to select some or all options presented at any time.&lt;/p&gt;
&lt;h5 id=&#34;app-variable&#34;&gt;&lt;code&gt;app&lt;/code&gt; variable&lt;/h5&gt;
&lt;p&gt;The query for this variable returns all the applications that exist.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;apps.*&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The values returned are &lt;code&gt;backend&lt;/code&gt;, &lt;code&gt;country&lt;/code&gt;, &lt;code&gt;fakesite&lt;/code&gt;, and &lt;code&gt;All&lt;/code&gt;.&lt;/p&gt;
&lt;h5 id=&#34;server-variable&#34;&gt;&lt;code&gt;server&lt;/code&gt; variable&lt;/h5&gt;
&lt;p&gt;The query for this variable returns all servers for the currently selected application.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;apps.$app.*&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the user selects &lt;code&gt;backend&lt;/code&gt;, then the query changes to:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;apps.backend.*&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The query returns all servers associated with &lt;code&gt;backend&lt;/code&gt;, including &lt;code&gt;backend_01&lt;/code&gt;, &lt;code&gt;backend_02&lt;/code&gt;, and so on.&lt;/p&gt;
&lt;p&gt;If the user selects &lt;code&gt;fakesite&lt;/code&gt;, then the query changes to:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;apps.fakesite.*&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The query returns all servers associated with &lt;code&gt;fakesite&lt;/code&gt;, including &lt;code&gt;web_server_01&lt;/code&gt;, &lt;code&gt;web_server_02&lt;/code&gt;, and so on.&lt;/p&gt;
&lt;h5 id=&#34;more-variables&#34;&gt;More variables&lt;/h5&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;This example is theoretical. The Graphite server used in the example doesn&amp;rsquo;t contain CPU metrics.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The dashboard stops at two levels, but you could keep going. For example, if you wanted to get CPU metrics for selected servers, you could copy the &lt;code&gt;server&lt;/code&gt; variable and extend the query so that it reads:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;apps.$app.$server.cpu.*&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This query returns all the CPU metrics for the selected server.&lt;/p&gt;
&lt;p&gt;Depending on what variable options the user selects, you could get queries like:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;apps.backend.backend_01.cpu.*
apps.{backend.backend_02,backend_03}.cpu.*
apps.fakesite.web_server_01.cpu.*&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;influxdb-example-explained&#34;&gt;InfluxDB example explained&lt;/h4&gt;
&lt;p&gt;In this example, you have several data centers. Each data center has a different subset of hosts. It&amp;rsquo;s based on the &lt;a href=&#34;https://play.grafana.org/d/e7bad3ef-db0c-4bbd-8245-b85c0b2ca2b9/influx-2-73a-hourly-electric-grid-monitor-for-us?orgId=1&amp;amp;refresh=1m&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB Templated&lt;/a&gt; dashboard.&lt;/p&gt;
&lt;p&gt;In this example, when the user changes the value of the &lt;code&gt;datacenter&lt;/code&gt; variable, it changes the drop-down options returned by the &lt;code&gt;host&lt;/code&gt; variable. The &lt;code&gt;host&lt;/code&gt; variable uses the &lt;strong&gt;Multi-value&lt;/strong&gt; option and &lt;strong&gt;Include all option&lt;/strong&gt;, allowing users to select some or all options presented at any time. The &lt;code&gt;datacenter&lt;/code&gt; does not use either option, so you can only select one data center at a time.&lt;/p&gt;
&lt;h5 id=&#34;datacenter-variable&#34;&gt;&lt;code&gt;datacenter&lt;/code&gt; variable&lt;/h5&gt;
&lt;p&gt;The query for this variable returns all the data centers that exist.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;datacenter&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The values returned are &lt;code&gt;America&lt;/code&gt;, &lt;code&gt;Africa&lt;/code&gt;, &lt;code&gt;Asia&lt;/code&gt;, and &lt;code&gt;Europe&lt;/code&gt;.&lt;/p&gt;
&lt;h5 id=&#34;host-variable&#34;&gt;&lt;code&gt;host&lt;/code&gt; variable&lt;/h5&gt;
&lt;p&gt;The query for this variable returns all hosts for the currently selected data center.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;hostname&amp;#34; WHERE &amp;#34;datacenter&amp;#34; =~ /^$datacenter$/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the user selects &lt;code&gt;America&lt;/code&gt;, then the query changes to:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;hostname&amp;#34; WHERE &amp;#34;datacenter&amp;#34; =~ /^America/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The query returns all servers associated with &lt;code&gt;America&lt;/code&gt;, including &lt;code&gt;server1&lt;/code&gt;, &lt;code&gt;server2&lt;/code&gt;, and so on.&lt;/p&gt;
&lt;p&gt;If the user selects &lt;code&gt;Europe&lt;/code&gt;, then the query changes to:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;hostname&amp;#34; WHERE &amp;#34;datacenter&amp;#34; =~ /^Europe/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The query returns all servers associated with &lt;code&gt;Europe&lt;/code&gt;, including &lt;code&gt;server3&lt;/code&gt;, &lt;code&gt;server4&lt;/code&gt;, and so on.&lt;/p&gt;
&lt;h5 id=&#34;more-variables-1&#34;&gt;More variables&lt;/h5&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;This example is theoretical. The InfluxDB server used in the example doesn&amp;rsquo;t contain CPU metrics.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The dashboard stops at two levels, but you could keep going. For example, if you wanted to get CPU metrics for selected hosts, you could copy the &lt;code&gt;host&lt;/code&gt; variable and extend the query so that it reads:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;cpu&amp;#34; WHERE &amp;#34;datacenter&amp;#34; =~ /^$datacenter$/ AND &amp;#34;host&amp;#34; =~ /^$host$/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This query returns the CPU metrics for the selected host.&lt;/p&gt;
&lt;p&gt;Depending on what variable options the user selects, you could get queries like:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;cpu&amp;#34; WHERE &amp;#34;datacenter&amp;#34; =~ /^America/ AND &amp;#34;host&amp;#34; =~ /^server2/
SHOW TAG VALUES WITH KEY = &amp;#34;cpu&amp;#34; WHERE &amp;#34;datacenter&amp;#34; =~ /^Africa/ AND &amp;#34;host&amp;#34; =~ /^server/7/
SHOW TAG VALUES WITH KEY = &amp;#34;cpu&amp;#34; WHERE &amp;#34;datacenter&amp;#34; =~ /^Europe/ AND &amp;#34;host&amp;#34; =~ /^server3&amp;#43;server4/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;best-practices-for-chained-variables&#34;&gt;Best practices for chained variables&lt;/h3&gt;
&lt;p&gt;The following practices make your dashboards and variables easier to use.&lt;/p&gt;
&lt;h4 id=&#34;new-linked-variables-creation&#34;&gt;New linked variables creation&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Chaining variables create parent/child dependencies. You can envision them as a ladder or a tree.&lt;/li&gt;
&lt;li&gt;The easiest way to create a new chained variable is to copy the variable that you want to base the new one on. In the variable list, click the &lt;strong&gt;Duplicate variable&lt;/strong&gt; icon to the right of the variable entry to create a copy. You can then add on to the query for the parent variable.&lt;/li&gt;
&lt;li&gt;New variables created this way appear at the bottom of the list. You might need to drag it to a different position in the list to get it into a logical order.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;variable-order&#34;&gt;Variable order&lt;/h4&gt;
&lt;p&gt;You can change the orders of variables in the dashboard variable list by clicking the up and down arrows on the right side of each entry. Grafana lists variable dropdowns left to right according to this list, with the variable at the top on the far left.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;List variables that don&amp;rsquo;t have dependencies at the top, before their child variables.&lt;/li&gt;
&lt;li&gt;Each variable should follow the one it&amp;rsquo;s dependent on.&lt;/li&gt;
&lt;li&gt;Remember there is no indication in the UI of which variables have dependency relationships. List the variables in a logical order to make it easier for others to use.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;complexity-consideration&#34;&gt;Complexity consideration&lt;/h4&gt;
&lt;p&gt;The more layers of dependency you have in variables, the longer it takes to update dashboards after you change variables.&lt;/p&gt;
&lt;p&gt;For example, if you have a series of four linked variables (country, region, server, metric) and you change a root variable value (country), then Grafana must run queries for all the dependent variables before it updates the visualizations in the dashboard.&lt;/p&gt;
&lt;!-- vale Grafana.WordList = NO --&gt;
&lt;h2 id=&#34;filter-variables-with-regex&#34;&gt;Filter variables with regular expressions&lt;/h2&gt;
&lt;p&gt;Using the &lt;strong&gt;Regex&lt;/strong&gt; query option, you filter the list of options returned by the variable query or modify the options returned.&lt;/p&gt;
&lt;p&gt;This section shows how to use a regular expression to filter or modify values in the variable drop-down list.&lt;/p&gt;
&lt;p&gt;Using the &lt;strong&gt;Regex&lt;/strong&gt; query option, you filter the list of options returned by the Variable query or modify the options returned. For more information, refer to the Mozilla guide on &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Regular expressions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Examples of filtering on the following list of options:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;backend_01
backend_02
backend_03
backend_04&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;filter-to-return-only-the-options-that-end-with-01-or-02&#34;&gt;Filter to return only the options that end with &lt;code&gt;01&lt;/code&gt; or &lt;code&gt;02&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Regex&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;regex&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-regex&#34;&gt;/(01|02)$/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Result:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;backend_01
backend_02&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;filter-and-modify-the-options-using-a-regular-expression-to-capture-group-to-return-part-of-the-text&#34;&gt;Filter and modify the options using a regular expression to capture group to return part of the text&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Regex&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;regex&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-regex&#34;&gt;/.*(01|02)/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Result:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;01
02&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;filter-and-modify-prometheus-example&#34;&gt;Filter and modify: Prometheus Example&lt;/h3&gt;
&lt;p&gt;List of options:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;up{instance=&amp;#34;demo.robustperception.io:9090&amp;#34;,job=&amp;#34;prometheus&amp;#34;} 1 1521630638000
up{instance=&amp;#34;demo.robustperception.io:9093&amp;#34;,job=&amp;#34;alertmanager&amp;#34;} 1 1521630638000
up{instance=&amp;#34;demo.robustperception.io:9100&amp;#34;,job=&amp;#34;node&amp;#34;} 1 1521630638000&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Regex&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;regex&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-regex&#34;&gt;/.*instance=&amp;#34;([^&amp;#34;]*).*/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Result:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;demo.robustperception.io:9090
demo.robustperception.io:9093
demo.robustperception.io:9100&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;filter-and-modify-using-named-text-and-value-capture-groups&#34;&gt;Filter and modify using named text and value capture groups&lt;/h3&gt;
&lt;p&gt;Using named capture groups, you can capture separate &amp;rsquo;text&amp;rsquo; and &amp;lsquo;value&amp;rsquo; parts from the options returned by the variable query. This allows the variable drop-down list to contain a friendly name for each value that can be selected.&lt;/p&gt;
&lt;p&gt;For example, when querying the &lt;code&gt;node_hwmon_chip_names&lt;/code&gt; Prometheus metric, the &lt;code&gt;chip_name&lt;/code&gt; is a lot friendlier than the &lt;code&gt;chip&lt;/code&gt; value. So the following variable query result:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;node_hwmon_chip_names{chip=&amp;#34;0000:d7:00_0_0000:d8:00_0&amp;#34;,chip_name=&amp;#34;enp216s0f0np0&amp;#34;} 1
node_hwmon_chip_names{chip=&amp;#34;0000:d7:00_0_0000:d8:00_1&amp;#34;,chip_name=&amp;#34;enp216s0f0np1&amp;#34;} 1
node_hwmon_chip_names{chip=&amp;#34;0000:d7:00_0_0000:d8:00_2&amp;#34;,chip_name=&amp;#34;enp216s0f0np2&amp;#34;} 1
node_hwmon_chip_names{chip=&amp;#34;0000:d7:00_0_0000:d8:00_3&amp;#34;,chip_name=&amp;#34;enp216s0f0np3&amp;#34;} 1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Passed through the following regular expression:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;regex&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-regex&#34;&gt;/chip_name=&amp;#34;(?&amp;lt;text&amp;gt;[^&amp;#34;]&amp;#43;)|chip=&amp;#34;(?&amp;lt;value&amp;gt;[^&amp;#34;]&amp;#43;)/g&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Would produce the following drop-down list:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;text&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-text&#34;&gt;Display Name          Value
------------          -------------------------
enp216s0f0np0         0000:d7:00_0_0000:d8:00_0
enp216s0f0np1         0000:d7:00_0_0000:d8:00_1
enp216s0f0np2         0000:d7:00_0_0000:d8:00_2
enp216s0f0np3         0000:d7:00_0_0000:d8:00_3&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Only &lt;code&gt;text&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt; capture group names are supported.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

]]></content><description>&lt;h1 id="advanced-variable-configurations">Advanced variable configurations&lt;/h1>
&lt;p>The advanced variable configurations described on this page help you build dashboards that adapt to complex data structures and user selections:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Multi-property variables&lt;/strong>: Map one logical value to multiple source-specific values.&lt;/li>
&lt;li>&lt;strong>Chained variables&lt;/strong>: Update the options in one variable based on the selections in another.&lt;/li>
&lt;li>&lt;strong>Regular expression filtering&lt;/strong>: Filter the values returned by a variable query.&lt;/li>
&lt;/ul>
&lt;p>These configurations are useful for dashboards that span multiple environments, data sources, regions, clusters, namespaces, or other hierarchical data.&lt;/p></description></item><item><title>Variable syntax</title><link>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/variable-syntax/</link><pubDate>Tue, 23 Jun 2026 13:06:40 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/variable-syntax/</guid><content><![CDATA[&lt;h1 id=&#34;variable-syntax&#34;&gt;Variable syntax&lt;/h1&gt;
&lt;p&gt;Panel titles and metric queries can refer to variables using two different syntaxes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$varname&lt;/code&gt;
This syntax is easy to read, but it doesn&amp;rsquo;t allow you to use a variable in the middle of a word.
&lt;strong&gt;Example:&lt;/strong&gt; apps.frontend.$server.requests.count&lt;/li&gt;
&lt;li&gt;&lt;code&gt;${var_name}&lt;/code&gt; Use this syntax when you want to interpolate a variable in the middle of an expression.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;${var_name:&amp;lt;format&amp;gt;}&lt;/code&gt; This format gives you more control over how Grafana interpolates values. Refer to &lt;a href=&#34;#advanced-variable-format-options&#34;&gt;Advanced variable format options&lt;/a&gt; for more detail on all the formatting types.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[[varname]]&lt;/code&gt; Do not use. Deprecated syntax, that will be removed in a future release.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before queries are sent to your data source, the query is &lt;em&gt;interpolated&lt;/em&gt;, meaning the variable is replaced with its current value.
During interpolation, the variable value might be &lt;em&gt;escaped&lt;/em&gt; to conform to the syntax of the query language and where it&amp;rsquo;s used.
For example, variables in InfluxDB or Prometheus regular expression queries are automatically escaped.
Read the data source specific documentation topic for details on value escaping during interpolation.&lt;/p&gt;
&lt;p&gt;For advanced syntax to override data source default formatting, refer to &lt;a href=&#34;#advanced-variable-format-options&#34;&gt;Advanced variable format options&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;advanced-variable-format-options&#34;&gt;Advanced variable format options&lt;/h2&gt;
&lt;p&gt;The formatting of the variable interpolation depends on the data source, but there are some situations where you might want to change the default formatting.&lt;/p&gt;
&lt;p&gt;For example, the default for the MySql data source is to join multiple values as comma-separated with quotes: &lt;code&gt;&#39;server01&#39;,&#39;server02&#39;&lt;/code&gt;.
In some cases, you might want to have a comma-separated string without quotes: &lt;code&gt;server01,server02&lt;/code&gt;.
You can make that happen with advanced variable formatting options listed below.&lt;/p&gt;
&lt;h3 id=&#34;general-syntax&#34;&gt;General syntax&lt;/h3&gt;
&lt;p&gt;Syntax: &lt;code&gt;${var_name:option}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Test the formatting options on the &lt;a href=&#34;https://play.grafana.org/d/cJtIfcWiz/template-variable-formatting-options?orgId=1&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Play site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If any invalid formatting option is specified, then &lt;code&gt;glob&lt;/code&gt; is the default/fallback option.&lt;/p&gt;
&lt;p&gt;An alternative syntax (that might be deprecated in the future) is &lt;code&gt;[[var_name:option]]&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;csv&#34;&gt;CSV&lt;/h3&gt;
&lt;p&gt;Formats variables with multiple values as a comma-separated string.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:csv}&amp;#39;
Interpolation result: &amp;#39;test1,test2&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;distributed---opentsdb&#34;&gt;Distributed - OpenTSDB&lt;/h3&gt;
&lt;p&gt;Formats variables with multiple values in custom format for OpenTSDB.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:distributed}&amp;#39;
Interpolation result: &amp;#39;test1,servers=test2&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;doublequote&#34;&gt;&lt;code&gt;doublequote&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Formats single- and multi-valued variables into a comma-separated string, escapes &lt;code&gt;&amp;quot;&lt;/code&gt; in each value by &lt;code&gt;\&amp;quot;&lt;/code&gt; and quotes each value with &lt;code&gt;&amp;quot;&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:doublequote}&amp;#39;
Interpolation result: &amp;#39;&amp;#34;test1&amp;#34;,&amp;#34;test2&amp;#34;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;glob---graphite&#34;&gt;Glob - Graphite&lt;/h3&gt;
&lt;p&gt;Formats variables with multiple values into a glob (for Graphite queries).&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:glob}&amp;#39;
Interpolation result: &amp;#39;{test1,test2}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;join&#34;&gt;Join&lt;/h3&gt;
&lt;p&gt;Formats multi-valued variables with a custom delimiter. If no delimiter argument is supplied, they&amp;rsquo;re combined with &lt;code&gt;,&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#34;test1&amp;#34;, &amp;#34;test2&amp;#34;]
String to interpolate: &amp;#39;${servers:join:&amp;amp;}&amp;#39;
Interpolation result: &amp;#34;test1&amp;amp;test2&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;json&#34;&gt;JSON&lt;/h3&gt;
&lt;p&gt;Formats variables with multiple values as a comma-separated string.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:json}&amp;#39;
Interpolation result: &amp;#39;[&amp;#34;test1&amp;#34;, &amp;#34;test2&amp;#34;]&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;lucene---elasticsearch&#34;&gt;Lucene - Elasticsearch&lt;/h3&gt;
&lt;p&gt;Formats variables with multiple values in Lucene format for Elasticsearch.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:lucene}&amp;#39;
Interpolation result: &amp;#39;(&amp;#34;test1&amp;#34; OR &amp;#34;test2&amp;#34;)&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;percentencode&#34;&gt;&lt;code&gt;percentencode&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Formats single and multi valued variables for use in URL parameters.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;foo()bar BAZ&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:percentencode}&amp;#39;
Interpolation result: &amp;#39;foo%28%29bar%20BAZ%2Ctest2&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;pipe&#34;&gt;Pipe&lt;/h3&gt;
&lt;p&gt;Formats variables with multiple values into a pipe-separated string.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1.&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:pipe}&amp;#39;
Interpolation result: &amp;#39;test1.|test2&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;query-parameters&#34;&gt;Query parameters&lt;/h3&gt;
&lt;p&gt;Formats single- and multi-valued variables into their query parameter representation. Example: &lt;code&gt;var-foo=value1&amp;amp;var-foo=value2&lt;/code&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#34;test1&amp;#34;, &amp;#34;test2&amp;#34;]
String to interpolate: &amp;#39;${servers:queryparam}&amp;#39;
Interpolation result: &amp;#34;var-servers=test1&amp;amp;var-servers=test2&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Use the &lt;code&gt;customqueryparam&lt;/code&gt; formatter to customize how the query parameters are formatted. It accepts two optional arguments to specify the parameter name, and a value prefix.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#34;test1&amp;#34;, &amp;#34;test2&amp;#34;]
String to interpolate: &amp;#39;${servers:customqueryparam:v-servers:x-}&amp;#39;
Interpolation result: &amp;#34;v-servers=x-test1&amp;amp;v-servers=x-test2&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;raw&#34;&gt;Raw&lt;/h3&gt;
&lt;p&gt;Doesn&amp;rsquo;t apply any data source-specific formatting to the variable.&lt;/p&gt;
&lt;p&gt;For example, in this case, there&amp;rsquo;s a dashboard with a Prometheus data source and a multi-value variable.
Grafana typically converts the variable values as follows to accommodate Prometheus:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1.&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers}&amp;#39;
Interpolation result: &amp;#39;(test1 | test2)&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Using the raw format, the values are returned without that formatting:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1.&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:raw}&amp;#39;
Interpolation result: &amp;#39;test1,test2&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;regex&#34;&gt;Regex&lt;/h3&gt;
&lt;p&gt;Formats variables with multiple values into a regular expression string.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1.&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:regex}&amp;#39;
Interpolation result: &amp;#39;(test1\.|test2)&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;singlequote&#34;&gt;&lt;code&gt;singlequote&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Formats single- and multi-valued variables into a comma-separated string, escapes &lt;code&gt;&#39;&lt;/code&gt; in each value by &lt;code&gt;\&#39;&lt;/code&gt; and quotes each value with &lt;code&gt;&#39;&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#39;test1&amp;#39;, &amp;#39;test2&amp;#39;]
String to interpolate: &amp;#39;${servers:singlequote}&amp;#39;
Interpolation result: &amp;#34;&amp;#39;test1&amp;#39;,&amp;#39;test2&amp;#39;&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;sqlstring&#34;&gt;&lt;code&gt;sqlstring&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Formats single- and multi-valued variables into a comma-separated string, escapes &lt;code&gt;&#39;&lt;/code&gt; in each value by &lt;code&gt;&#39;&#39;&lt;/code&gt; and quotes each value with &lt;code&gt;&#39;&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#34;test&amp;#39;1&amp;#34;, &amp;#34;test2&amp;#34;]
String to interpolate: &amp;#39;${servers:sqlstring}&amp;#39;
Interpolation result: &amp;#34;&amp;#39;test&amp;#39;&amp;#39;1&amp;#39;,&amp;#39;test2&amp;#39;&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;text&#34;&gt;Text&lt;/h3&gt;
&lt;p&gt;Formats single- and multi-valued variables into their text representation. For a single variable it just returns the text representation. For multi-valued variables it returns the text representation combined with &lt;code&gt;&#43;&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;servers = [&amp;#34;test1&amp;#34;, &amp;#34;test2&amp;#34;]
String to interpolate: &amp;#39;${servers:text}&amp;#39;
Interpolation result: &amp;#34;test1 &amp;#43; test2&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="variable-syntax">Variable syntax&lt;/h1>
&lt;p>Panel titles and metric queries can refer to variables using two different syntaxes:&lt;/p>
&lt;ul>
&lt;li>&lt;code>$varname&lt;/code>
This syntax is easy to read, but it doesn&amp;rsquo;t allow you to use a variable in the middle of a word.
&lt;strong>Example:&lt;/strong> apps.frontend.$server.requests.count&lt;/li>
&lt;li>&lt;code>${var_name}&lt;/code> Use this syntax when you want to interpolate a variable in the middle of an expression.&lt;/li>
&lt;li>&lt;code>${var_name:&amp;lt;format&amp;gt;}&lt;/code> This format gives you more control over how Grafana interpolates values. Refer to &lt;a href="#advanced-variable-format-options">Advanced variable format options&lt;/a> for more detail on all the formatting types.&lt;/li>
&lt;li>&lt;code>[[varname]]&lt;/code> Do not use. Deprecated syntax, that will be removed in a future release.&lt;/li>
&lt;/ul>
&lt;p>Before queries are sent to your data source, the query is &lt;em>interpolated&lt;/em>, meaning the variable is replaced with its current value.
During interpolation, the variable value might be &lt;em>escaped&lt;/em> to conform to the syntax of the query language and where it&amp;rsquo;s used.
For example, variables in InfluxDB or Prometheus regular expression queries are automatically escaped.
Read the data source specific documentation topic for details on value escaping during interpolation.&lt;/p></description></item><item><title>Manage and inspect variables</title><link>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/inspect-variable/</link><pubDate>Tue, 23 Jun 2026 13:06:40 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/inspect-variable/</guid><content><![CDATA[&lt;h1 id=&#34;manage-and-inspect-variables&#34;&gt;Manage and inspect variables&lt;/h1&gt;
&lt;p&gt;In the &lt;strong&gt;Variables&lt;/strong&gt; tab, you can 
    &lt;a href=&#34;/docs/grafana/v13.1/visualizations/dashboards/variables/add-template-variables/&#34;&gt;add&lt;/a&gt; variables and &lt;a href=&#34;#manage-variables&#34;&gt;manage&lt;/a&gt; existing variables. You can also &lt;a href=&#34;#inspect-variables&#34;&gt;inspect&lt;/a&gt; variables to identify any dependencies between them.&lt;/p&gt;
&lt;!--whether a variable is being referenced (or used) in other variables or dashboard.--&gt;
&lt;h2 id=&#34;manage-variables&#34;&gt;Manage variables&lt;/h2&gt;
&lt;p&gt;You can take the following actions in the &lt;strong&gt;Variables&lt;/strong&gt; tab:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Move&lt;/strong&gt;: Move a variable up or down the list using drag and drop.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clone&lt;/strong&gt;: Clone a variable by clicking the clone icon in the set of icons on the right. This creates a copy of the variable with the name of the original variable prefixed with &lt;code&gt;copy_of_&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Delete&lt;/strong&gt;: Delete a variable by clicking the trash icon in the set of icons on the right.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;inspect-variables&#34;&gt;Inspect variables&lt;/h2&gt;
&lt;p&gt;In addition to &lt;a href=&#34;#manage-variables&#34;&gt;managing variables&lt;/a&gt;, the &lt;strong&gt;Variables&lt;/strong&gt; tab lets you quickly identify whether variables have any dependencies. To check, click &lt;strong&gt;Show dependencies&lt;/strong&gt; at the bottom of the list, which opens the dependencies diagram:&lt;/p&gt;
&lt;!-- Update and comment this back in when the reference functionality is working again

The variables page lets you easily identify whether a variable is being referenced (or used) in other variables or dashboard. In addition, you can also [add](https://grafana.com/docs/grafana/&lt;GRAFANA_VERSION&gt;/visualizations/dashboards/variables/add-template-variables/) and [manage variables](#manage-variables) on this page.

![Variables list](/static/img/docs/variables-templates/variables-list-7-4.png)

Any variable that is referenced or used has a green check mark next to it, while unreferenced variables have a orange caution icon next to them.

![Variables list](/static/img/docs/variables-templates/variable-not-referenced-7-4.png)

In addition, all referenced variables have a dependency icon next to the green check mark. You can click on the icon to view the dependency map. The dependency map can be moved. You can zoom in out with mouse wheel or track pad equivalent.--&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/static/img/docs/variables-templates/dependancy-map-7-4.png&#34;
  alt=&#34;Dependency map showing relationships between dashboard variables&#34; width=&#34;772&#34;
     height=&#34;580&#34;/&gt;&lt;/p&gt;
]]></content><description>&lt;h1 id="manage-and-inspect-variables">Manage and inspect variables&lt;/h1>
&lt;p>In the &lt;strong>Variables&lt;/strong> tab, you can
&lt;a href="/docs/grafana/v13.1/visualizations/dashboards/variables/add-template-variables/">add&lt;/a> variables and &lt;a href="#manage-variables">manage&lt;/a> existing variables. You can also &lt;a href="#inspect-variables">inspect&lt;/a> variables to identify any dependencies between them.&lt;/p>
&lt;!--whether a variable is being referenced (or used) in other variables or dashboard.-->
&lt;h2 id="manage-variables">Manage variables&lt;/h2>
&lt;p>You can take the following actions in the &lt;strong>Variables&lt;/strong> tab:&lt;/p></description></item></channel></rss>