Create a dependent Dropdown

When creating a Dropdown (if you’re using Visual SQL, see our Visual SQL Dropdown info) 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 filter 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 to filter our Table by company, but this company list is extensive as we have multiple customers from various states. We’d like to only look at companies from selected states 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).

In the Visual SQL interface

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

  1. From your dashboard’s right-side menu, click on Add Control > Dropdown.
  2. Add the Company column from the Users table to the Columns section and use the Group aggregation in the Result Table.
  3. Rename the Control to COMPANY and fill out the Control’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. We also chose the Show All Empty state and deselected Initial value(s).
  4. Click Save to Dashboard when you’re ready to place your new Dropdown on your dashboard.

    Create a Company Dropdown using the Company column in the Users table

Connect your Dropdown to your chart

  1. Open Visual SQL by clicking Edit Chart Data from the chart’s ellipsis menu.
  2. Add the Company column to the Filters section, select the Is one of filter operator, and select {COMPANY} for the filter value.
  3. Click Save to Dashboard to save your changes.

    Connect the Company Dropdown to your chart by using it in the chart's Filters

Your chart is now set up to filter using the Company Dropdown. To filter the Company Dropdown itself, we’ll need to create another Dropdown with the customers’ states.

Create another Dropdown

Follow the same steps outlined above to add a second Dropdown. This time you’ll want to pull in the customers’ states by adding the State column from the Users table to the Columns section in Visual SQL. We’ll name this filter STATE, select Multi-select, choose the Show All Empty state, and deselect Initial value(s). When you’re done changing the settings, click Save to Dashboard to place your second Dropdown on your dashboard.

Create a State Dropdown using the State column in the Users table

Add the new Dropdown as a Filter to your initial Dropdown

You can also add Filters when creating/editing a Dropdown! Pretty cool, right?

  1. Edit the initial COMPANY Dropdown by opening its ellipses menu and clicking Edit Filter.
  2. Add the State column to the Filters section, select the Is one of filter operator, and select {STATE} for the filter value.

Connect the State Dropdown to the 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.

Final result on the dashboard after creating a dependent Dropdown

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


In the Data Explorer interface

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

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 Control to “COMPANY” and fill out the Control’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 Controls 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 instance, try using a Text Input instead of the first Dropdown to manually enter filter options.