---
title: "Chain variables together | Grafana Labs"
description: "Learn how to create dependent variable relationships and cascading filters."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Chain variables together

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.

Cascading filter patterns are common in multi-tier filtering scenarios such as region &gt; cluster &gt; namespace &gt; pod. Each level narrows the available options based on the previous selection, creating an intuitive navigation experience through your infrastructure or data hierarchy.

To create chained variables, complete the following steps:

01. Open your dashboard and click **Edit**.
02. In the right sidebar, click **Dashboard options** (gear icon).
03. Create your first-level (parent) variable if you don’t already have one.
    
    For example, in the **Variables** section click **Add variable**, choose **Query**, name it `region`, and enter query `label_values(region)`. Click **Save** when finished.
04. In the **Variables** section of the pane, click **Add variable** to create a dependent (child) variable.
05. Click **Query** to choose the query variable type.
06. Name your dependent variable.
    
    For example, enter `cluster`.
07. Under **Query options**, click **Open variable editor**.
08. Under **Query type**, select **Classic query** so the **Query** field appears.
    
    In the **Query** field, reference the parent variable to filter results.
    
    For example, use `label_values(up{region="$region"}, cluster)`.
09. Click **Close** to finish configuring the query.
10. Click **Save** to save the dashboard with your chained variables.
11. Test the cascading behavior by changing the parent variable selection. The dependent variable options should update automatically.
    
    Repeat to add additional levels—for example, a `namespace` variable that depends on `cluster`.

Selecting a value in the parent variable updates the available options in dependent variables, creating a cascading filter experience.

In the next milestone, you learn how to configure variable display options to control how variables appear to your users.

* * *

### More to explore (optional)

At this point in your journey, you can explore the following paths:

- [Chained variable examples](/docs/grafana/latest/visualizations/dashboards/variables/add-template-variables/#grafana-play-dashboard-examples)
