Create Date "Buttons"

Do your users want to filter your dashboard by the Days, Weeks, Months and Years? I like to create a set of buttons as shown below with D, W, M and Y for this. Visually it does not take up a lot of room, and this is another option for your clients instead of using a boring old filter.


Date "Button" Example:

To put it into context, I use this button to filter the axis in the below line chart. The user can see the line graph by the date increments.


In order to create these buttons, I start with creating the following Parameter.


Date Part Example


I create a Calculated field as shown below on the sheet with a line graph.


Date with DATETRUNC

Date(DateTRUNC([Date Part Example],[Order Date]))


I will use this calculated field to replace the Order Date field in the Columns shelf.


I then create an Excel spreadsheet with the following;


I save this as a Control Sheet.xlsx

I connect it to Tableau and format it as below;



On the Columns shelf, I right-click to create a new calculation.

I then type Min(1)


This will change the worksheet to a bar chart and appear as below;


I then right-click on the axis to edit it and give it a Fixed end of 1.


This will expand the bars all the way across the pane.

I then hide all the Headers.

I remove all the grid lines, pane lines etc.

I move the Date Part Value measure to the Color Marks card.

I change the alignment for the Text to Middle by clicking on the Label Marks card. I also adjust the size of the Font, and make it bold.

I also expand the worksheet to display as the Entire view.

I right-click on the Date Part Display pill in the Columns shelf and set the sort to Manual. I move the M value below the W value.


Now I place this sheet on the dashboard.

I go to the Dashboard menu and select Actions.

I create a Parameter action by selecting the Add Action button and selecting Change Parameter.

I configure the Parameter as follows;



I then click OK when all the values are set like the example above.

I am now be able to change the axis of the line chart with the different Date "buttons."


I have this example for you to download in my Tableau Public dashboard here.

170 views0 comments