Get started with Atlassian Analytics
Learn how to add Atlassian Analytics to a site and understand what you need to query data and create charts.
Atlassian Analytics provides convenient variables that you can use to dynamically update values in your charts and dashboards. There are three types of variables:
Dashboard variables
Relative date variables
Current user variable
You reference variables by wrapping their names in curly braces { }.
You can use variables in:
visual mode and SQL mode queries
column names
other Visual SQL steps
built-in formulas and custom formulas
chart titles
text elements
Whenever you add a 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. Learn more about controls.
For example, if you add a “Dropdown” control to your dashboard and name the control 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 that you want to use it on.
Relative date variables are built-in variables that each resolve to a single date string. You can use them anywhere you would otherwise enter a date value. For example, you can use them:
to set default dates for “Calendar” and “Date slider” controls
in custom formulas in Visual SQL steps
in SQL mode queries
in visual mode query filters
Relative date variables are global variables, so you can use them across Atlassian Analytics. When they’re used to filter charts on a dashboard, they follow the time zone that 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 that you’re querying.
View all the available relative date variables.
Apply date and time functions to relative date variables to customize the returned date to fit your needs. Learn more about date and time functions.
The following image shows an example of using the relative date variable {TODAY} in a “Filter” step. This filters the data to only include results for dates before today’s date. By using the {TODAY} variable, the date returned for today’s date automatically changes, so you don’t need to manually change the chart using a static date value.
Catering dashboards to a specific viewer is possible with the use of the current user variable.
Use the following syntax to reference it: {CURRENT_USER}.
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 currently viewing the dashboard.
Just like relative date variables, the current user variable is also a global variable. You can use it to filter queries or display the current user’s ID on the dashboard by referencing the variable in a text element.
To use the current user variable in a visual mode query filter:
Select the column to filter. The column must contain user IDs.
Select = for the filter operator.
Type {CURRENT_USER} as the value.
For example, if you want to only show Jira issues where the current dashboard viewer is the assignee of those issues, you could add this a condition in your query filters: from the jira_issue table, set the assignee_account_id equal to {CURRENT_USER}.
Was this helpful?