• Documentation

Set up a “Date bucket” control

“Date bucket” controls let you change the time bucket used for connected charts.

Setting up a “Date bucket” control requires two main steps:

  1. Create the “Date bucket” control for your dashboard.

  2. Connect the “Date bucket” control to a chart.

Create a “Date bucket” control

To add a “Date bucket” control to your dashboard:

  1. Open the dashboard where you want to add the “Date bucket” control.

  2. Select Add control > Date bucket from the dashboard sidebar. A pop-up will appear for you to configure the control’s settings.

  3. Optionally, change the Name of the control.

  4. For Default value, select the default time bucket to use when opening the dashboard.

  5. Select Add.

  6. Place the newly created “Date bucket” control anywhere on your dashboard.

Connect a “Date bucket” control to a chart

After you’re created your “Date bucket” control, you’ll need to connect it to a chart to start using it to filter. Connect it to a chart by using its corresponding dashboard variable in a query.

You can also connect controls in other Visual SQL steps. Learn more about connecting controls outside of a query.

In a visual mode query

To connect a “Date bucket” control to a chart using a visual mode query:

  1. Open the chart editor by creating a new chart or editing an existing chart on the dashboard. You’ll need a chart containing a date or datetime column.

  2. Edit the visual mode query containing the date or datetime column.

  3. Open the column’s aggregation menu then select then name of your “Date bucket” control.

  4. Select Run query. The result table will update with the new filter applied to the data.

  5. Select Save to dashboard to save the chart.

Using a Date bucket control to aggregate the Created At column in a visual mode query.

In a SQL mode query

Connect a “Date bucket” control in your SQL mode query by using the following format to use its dashboard variable: {DATE_BUCKET_NAME.BUCKET('"table_name"."column_name"')}

  • Replace DATE_BUCKET_NAME with name of your control.

  • Make sure to wrap the table-column reference in single quotes.

  • In your GROUP BY clause, use the same column alias provided in your SELECT statement.

Here’s an example of how you might connect a “Date bucket” control to the created date of Jira issues:

1 2 3 SELECT {DATE_BUCKET_NAME.BUCKET('"Jira Issue"."created_at"')} AS "Date Bucket of Created At" FROM "public"."jira _issue" AS "Jira Issue" GROUP BY "Date Bucket of Created At"

Get the “Date bucket” value

To get the value of your “Date bucket” control, use {DATE_BUCKET_NAME}. The value is returned as an all-lowercase string (for example, day, week, year, etc.). This is useful if you want to perform different calculations that depend on the current value of the “Date bucket” control.

Verify your chart is connected to the control

To make sure you’ve properly connected your chart to the control, you could verify this by updating the values of the control and seeing if your connected chart filters accordingly.

Alternatively, there are two ways you can check for all charts that are connected to the control.

One option is to:

  1. Hover over the control.

  2. Select its More actions () menu > Highlight connections.

The other option is to:

  1. Select Settings from the dashboard sidebar.

  2. Go to the Controls tab.

  3. Select Highlight connections.

Both options highlight all elements on the dashboard that are connected to that particular control.

Still need help?

The Atlassian Community is here for you.