/
What are variables?
Our documentation has moved!

Our documentation now lives on the Atlassian Support site at https://support.atlassian.com/analytics/resources/.

What are variables?

Atlassian’s analytics offering provides convenient variables you can use to dynamically update values in your charts and dashboards. There are three types of variables:

  • Dashboard variables

  • Relative date variables

  • Current date variable

You reference variables by wrapping their names in curly braces { }.

Dashboard variables

Whenever you add a variable control to a dashboard, this creates a corresponding dashboard variable—which has the same name as the control. This dashboard variable is what you use in your charts and dashboards to refer to the corresponding control.

For example, if you add a “Dropdown” control to your dashboard and give the control the name “PROJECTS”, this creates a corresponding variable {PROJECTS}.

Dashboard variables are scoped to a single dashboard, so you’ll need to make a new one for every dashboard you want to use it on.

Relative date variables

Relative date variables each resolve to a single date string, so you can use them anywhere you would otherwise enter a date value. For example, you can:

  • set default dates for “Calendar” and “Date slider” controls

  • use in custom formulas in Visual SQL steps

  • use in SQL mode queries

  • use in visual mode query filters

Relative date variables are global variables, so you can use them across Atlassian’s analytics offering. When they’re used to filter charts on a dashboard, they follow the time zone the dashboard uses. When they’re used in queries that aren’t tied to a dashboard, they follow the time zone of the data source you’re querying.

View all the available relative date variables.

Current user variable

Catering dashboards to a specific viewer is possible with the use of the {CURRENT_USER} variable. This variable stores the user ID of the person currently viewing a dashboard. Use this variable in your queries to build dashboards and charts that filter data based on who is the current dashboard viewer.

Just like relative date variables, the {CURRENT_USER} variable is also a global variable. You can use them to filter queries and display the current user on the dashboard.

For example, if you want to only show Jira issues where the current dashboard user is the assignee of those issues, you could make this a condition in your query filters. From the jira_issue table, set the assignee_account_id equal to {CURRENT_USER}.

If you want to display the current user, you can add a text element to your dashboard and set the Text to {CURRENT_USER}.


More ways to use variables

Besides query filters, you can also use variables in:

  • Column names — can be used in both visual mode and SQL mode queries; for visual mode queries, set the label

  • Built-in and custom formulas

  • Other Visual SQL steps

  • Chart titles

  • Text elements

Example of using a variable to filter data

As mentioned previously, you can use variables in other Visual SQL steps, such as the “Filter” step. This lets you use data outside of your chart results to filter the chart output.

Variables can be used as is in the input field or can be combined to further customize your filters.

For example, if you want to only include results in your chart for dates later than your “Calendar” control’s start date, which has the name “CALENDAR”, you can type its variable name in the filter condition. Since we’re using a “Calendar” control with a date range, we need to use the specific syntax to get the start date: {CALENDAR.START}

'Filter' step where the 'Calendar' control's start date is used as an operand

 

Below is another example of the “Filter” step—this time using our relative date variable {TODAY} to only include results from dates before today’s date. This date automatically changes according to the current day and filters the chart without needing manual changes.

'Filter' step where the 'TODAY' relative date variable is used as an operand

 

Related content