Visual SQL - Dashboard Variables

Beta

Dashboard Variables are variables you can set on a dashboard-wide basis. They allow you to apply filters to multiple charts simultaneously.

Using a Dashboard Variable is a two-part process. First, you’ll create the variable, then you’ll connect it to one or more charts.


Dashboard Variables
Dropdown Hidden Variable
Text Input Calendar
Date Slider Range Input

Dashboard Dropdown Variable

Create a Dropdown

Click Add Control from the dashboard sidebar menu and select Dropdown. You’ll be redirected to the Data Explorer. Add the column you want to use for your category. The values in that column will populate a dropdown menu, which you can use to filter your charts.

Create a dashboard Dropdown to filter your charts

  • Data type: Select the data type for your Dropdown’s results (Text, Number, Boolean, Date).
  • Multi-select: Check this checkbox to allow filtering by multiple values at once. If selecting multi-select, be sure your connected chart’s filter is “is one of” and not “equals” or “like”.
  • Empty state: When no values are selected in the Dropdown, you can either Show all rows in the attached charts or Show none.
  • Initial value(s): Check this checkbox to set custom filter value(s) on load.

Connect a Dropdown to a chart

Open the chart you’d like to connect to your Dropdown in the Data Explorer. Add the column you want to filter your dataset on to the Filters section, select the filter type, and select your variable name.

A couple of things to keep in mind:

  • Your Dropdown must have the same data type as the column you’re filtering on.
  • Your filter type must match the type of Dropdown you’re using. For example, if you’ve left Multi-select unchecked in the Dropdown’s settings, make sure you don’t use filter type “is one of”.

Connect your Dropdowns to your charts by adding them as filters


Hidden Variable

Create a Hidden Variable

Click Add Control from the dashboard sidebar menu and select Hidden Variable. A modal will pop up for you to customize your variable settings.

For Date Range or a single Date, you can either set a specific date or choose a Relative Date Variable such as the last 30 days.

To set a list of numbers or strings as your variable, check the Is List checkbox, and click Add Value for each additional list item you’d like to add. We’ll translate this to a comma-separated list. Text lists will be quoted, numerical lists will not.

Add a hidden variable which can filter your charts without being visible on the dashboard

Connect a Hidden Variable to your chart

Open the chart you’d like to connect to your Hidden Variable in the Data Explorer. Add the column you want to filter your dataset on to the Filters section, select the filter type, and select your variable name. You’ll need to ensure your Hidden Variable has the same data type as the column you’re filtering on.

Connect a Hidden Variable to your chart by adding it as a filter


Text Input

Dashboard Text Input

Create a Text Input

Click Add Control from the dashboard sidebar menu and select Text Input. A modal will pop up for you to customize your variable settings.

Check Multi-value if you’d like to filter your charts by multiple values. When selected, choose whether all results (Show all) or no results (Show none) are displayed when no filter value is selected.

The Default Value will be used to filter your charts when no value is typed into the input box. This field is optional - leave it blank for an empty result set by default.

Add a Text Input to filter using numeric or text values

Partial string matching

The Text Input variable requires an exact string match. To search by partial strings, select filter type “LIKE” in the Data Explorer, and use percent signs around your search string as needed. For example, to filter by names that start with “A”, set your chart filter to filter by values ‘like’ your input variable (e.g., Name like {TEXT-INPUT-NAME}), and enter A% into the Text Input widget on your dashboard.

The input widget encloses the search value in single quotes, and therefore does not allow multiple input values at once.

For the Default Start and Default End date, you can either set a specific date or choose a Relative Date Variable such as the last 30 days.

Connect a Text Input to your chart

Open the chart you’d like to connect to your Text Input in the Data Explorer. Add the column you want to filter your dataset on to the Filters section, select the filter type, and type your variable name wrapped in curly braces. You’ll need to ensure your Text Input has the same data type as the column you’re filtering on. If you selected Multi-value when creating your text input, be sure to use filter type “is one of”, not “equals”.

Connect a Text Input to your chart by adding it as a filter


Calendar

Calendar Date Variable

Create a Calendar

Click Add Control from the dashboard sidebar menu and select Calendar. A modal will pop up for you to choose your Calendar variable settings.

For Data type, choose whether you want to filter your charts on a single Date or a Date Range.

Edit the Default value(s) using a custom date, or a Relative Date as needed.

Add a Calendar Variable to filter your charts by time

Connect a Calendar to your chart

Find the chart you want to connect to your Calendar and open it in the Data Explorer. Add the date column you want to filter by to the Filters section. Choose your filter type (you’ll probably want to use between or between and including), then type {CALENDAR_NAME.START} and {CALENDAR_NAME.END} for the start and end dates, respectively. Replace CALENDAR_NAME with your variable name.

Connect a Calendar to your chart by adding it as a filter


Date Slider

Date Slider Dashboard Variables

Create a Date Slider

Click Add Control from the dashboard sidebar menu and select Date Slider. You’ll be redirected to the Data Explorer where you’ll add a date column to the Columns section, click Run Query then edit it as needed. You can also add a numeric column to display the Date Slider in 2D. Then, set the default date range using fixed or Relative Dates and click Save to Dashboard once completed.

Create a Date Slider to filter using date ranges

Connect a Date Slider to your chart

Find the chart you want to connect to your Date Slider and open it in the Data Explorer. Add the date column you want to filter by to the Filters section. Choose your filter type (you’ll probably want to use “between” or “between and including”), then select {DATE_SLIDER_NAME.START} and {DATE_SLIDER_NAME.END} for the start and end dates, respectively. Replace DATE_SLIDER_NAME with your variable name.

Connect a Date Slider to your chart by adding it as a filter

If your Date Slider is grouped by hour or minute, select the between filter in the Date Slider Using Hour or Minute section.


Range Input

Add a range input to filter by a numeric range

Create a Range Input

Click Add Control from the dashboard sidebar menu and select Range Input. A modal will pop up for you to customize your variable settings.

Choose the Min and Max for your range, edit Precision if you’d like to include decimal values, and set the Default values that will be selected when the dashboard is first loaded.

Range Input Variable

Connect a Range Input to your chart

Open the chart you’d like to connect to your Range Input in the Data Explorer. Add the numeric column you want to filter your dataset on to the Filters section, select between and including for the filter type, then select {RANGE_INPUT_NAME.START} and {RANGE_INPUT_NAME.END} for the beginning and end of the range, respectively. Replace RANGE_INPUT_NAME with your variable name.

Add a Range Input to your chart by adding it as a filter


Related Beta Help Articles

See more