Building out a calendar in Tableau can be an interesting way of presenting information over time, but there are a few quirks that make it more difficult than it may seem. Here is a step-by-step guide to navigating those difficulties and making your Tableau calendar!
Load your data – I am using Tableau’s Sample Superstore EU data, but any data that contains a date dimension will do. Then you will need to create calculated fields for the row and column coordinates of your months. This can be done by applying the following calculations.
Place these calculated fields on columns and rows respectively, convert both to a discrete dimension, and change your mark type to square. Your canvas should look like this:
Now that we have our months, we need another column and row index for our days. With the right mouse button held, drag Order Date (or your respective date field) to columns, and select WEEKDAY(Order Date) as your aggregation. This will create columns for each day of the week. Next we need to create our rows. This step requires some table calculations, so hold onto your hat (there’s one in every fun visualisation). Create the following calculated field:
This calculated field, once it is configured properly, will adjust the rows to be the right height, accounting for their day of the week. Drag Week Number, the new calculated field, onto your rows. Then, again using your right mouse, drag Order Date onto your marks card twice – once as a discrete DAY aggregation, and once as a continuous DAY aggregation. Only one of these marks is needed, but having both will help your date formatting. The continuous DAY will be your date number to show in your labels, and the discrete day is the full date to show in the tooltip. You should end up with the following:
You also need to control for the year. For this you have two options. If you want to show only one year, drag Order Date onto filters, select YEAR, and filter only the year you wish to show. If you want to show multiple years you can drag Order Date to rows. The default aggregation is discrete years, so you don’t need to worry about holding the right mouse. Now it is time to configure your Week Number calculation. Right click on Week Number in rows, select edit table calculation, and configure it as follows:
Now the viz is almost complete!
All that is left now is the finishing touches. This is at your discretion. For my example, I have set my continuous DAY as a label, my discrete DAY as tooltip, and dragged SUM([Profit]) to colour. I have also removed most of my column and row headers, borders, and grid lines. By default, Tableau starts each week on a Sunday. If you want to fix this, right click on your data source and select Date Properties > Week Start to change the first day of the week. This is shown below.
And that’s it! Below is a screenshot of my finished version, which you can find here on Tableau public. As a final note, you might notice that the calendar has missing days – this is because the data has no observations on those days. If you want all days to be included in your calendar, make sure your data source includes each day.