Creating a dependent Dropdown

Variables

When creating a Dropdown to filter your charts, you may run into a situation where your control contains too many results to be useful or easily searchable. To narrow down your available results depending on a certain condition, you can easily create a dependent Dropdown. You’ll essentially be filtering a Dropdown using another Dropdown.

In this example, we used our SaaS Company Demo Data to create a Table listing out our customers and number of purchases. We want our Table set up to be filtered by company, but this list is extensive as we have multiple customers from various states. We would like to only look at companies from selected state to compare them in our Table.

Customer Stats Dashboard

To do this, you’ll need to create two Dropdowns, one with the initial broader categories (State) and a second with the results you want filtered (Company).

Create your first Dropdown using the Company column under the Users table

  1. On the right-side menu, click on Add Control > Dropdown.
  2. Select the Company column from the Users table and add as a Dimension.
  3. Rename the variable to “COMPANY” and fill out the variable’s options under the preview on the right side of the Editor. In this case, we opted to use the Multi-select option to be able to select multiple companies and compare them in our chart.

Company column

Connect your Dropdown to your chart

  1. Open your Data Explorer by clicking Edit Chart Data from the chart’s ellipsis menu.
  2. Add the Company column to the filter box in the Data Explorer and select the options Is one of and {COMPANY}.

Company Dropdown Filter
Your chart is now set up to filter using the Company Dropdown. To now get the company dropdown to be filtered itself, we’ll need to create another dropdown with the customers’ state.

Create another Dropdown

Follow the same steps outlined above to add a second Dropdown. This time you’ll want to pull in the customers’ state using the State column from the Users table and add it to the Dimensions field in your Data Explorer. We’ll name this filter “STATE” and also check the Multi-select option. When done with the settings, click Save Chart to save and get back to your dashboard.

State Dropdown

Add the new Dropdown as a filter to your initial Dropdown

Open the initial Dropdown (Company) and add your State column as a filter using Is one of and {STATE} from the dropdown lists.

State Filter in Company Dropdown
And there you have it. You can now make a selection for the State Dropdown to get a refined customer list in the Company Dropdown to better filter your Table.

This concept of dependency between dashboard variables can be applied in various ways, so don’t hesitate to play around with the different dashboard variables and controls to customize your dashboard. For example, try using a Text Input instead of the first Dropdown to manually enter filter options.

Check out the video below going over setting up a dependent Dropdown:


Related Variables Help Articles

See more