Filter with multi-select Dropdowns in a Visual SQL step

Still need help?

The Atlassian Community is here for you.

Ask the community

The most straightforward way to connect your multi-select “Dropdown” control outside of a query add a "Filter" step and use the “is one of” operator when setting up your filter condition (in other words "column_name" is one of {DROPDOWN_NAME}). However, if you have the “Show unfiltered chart data” setting selected for your “Dropdown” control, that method doesn’t handle this setting. This article describes an alternate method to connect your multi-select "Dropdown" control outside of a query and still handle the “Show unfiltered chart data” setting.

Let’s say we have a “Dropdown” control that lists all of the issue resolutions on your dashboard and has the following settings:

  • Multiple select is selected
  • When no values are selected “Show unfiltered chart data”

  • Initial value(s) is deselected

We want to select multiple resolutions in the “Dropdown” control and have our chart filter on those resolutions. Again, we could connect it in our query by adding the “Resolution” column to the “Filters” section and using the “is one of” operator, but let’s say we don’t want to do that because we need the initial query not to filter on any resolution selections. Therefore, the filtering must be done after the query by following the steps below:

  1. First, ensure the column you want to filter on is included in your result set. Unlike filtering directly in the query, you need the column in your result set so you can reference it outside of the query. For this example, the “Resolution” column must be in the result set.

  2. Next, create a boolean column that depends on the values of the column to filter (for this example, it’s the “Resolution” column). If we want to include the row in our results, the boolean column should show a 1; otherwise, it should show a 0.

    Add a "Formula column" step, select Custom as the formula type, and use the following CASE statement as the formula, replacing DROPDOWN_NAME with the name of your “Dropdown” control and Resolution with the name of the column you’re using to filter:

     CASE WHEN {DROPDOWN_NAME.IN('"Resolution"')} THEN 1 ELSE 0 END

    This will connect the “Dropdown” control to your chart.

  3. Now add a "Filter" step to correctly filter on the selected values of the “Dropdown” control. Select to include rows matching all conditions where the Custom formula column equals 1 ("Custom Formula" = 1).

    Note: If you’re trying to implement an “is not one of” filter, you’d just need to change include to exclude.

  4. Lastly, hide the boolean “Custom formula” column since it’s no longer necessary. You can also hide the column used to create the boolean column if you no longer need it too.

    If you followed these steps correctly, your multi-select “Dropdown” control should now be connected to your chart, and you can filter your chart using multiple selections from the “Dropdown” control of resolutions.

    This process also works for multi-select Text inputs. Go ahead and try it out!

Last modified on Jul 17, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.