January
7
2009
It’s a new year and while I’ve effectively been on hiatus from this blog for about 4 months it’s probably time to get started again.
We’ve been using Tableau at work for about three months during which I had something of a rare experience (or at least rare to me). Still being a neophyte with Tableau it was surprising to me that building a simple calendar view of data hadn’t occurred to the Tableau team. Purists will argue (and who’s to disagree) that calendars don’t make the best data visualizations (lack of ability to see trends, low data to ink ration, blah blah blah) but when you have a set of users that prefer a calendar AND everyone is already trained to use/read/interpret a calendar, it’s a compromise I can live with.
Long story short, it was easy enough to build the calendar framework in Tableau but I was still new enough to struggle with getting the data into the calendar in the way that I wanted. So, I reached out to the Sales Engineering team at Tableau (Thanks Ty!) and they he helped me out. The surprising part was the mini-storm of attention that this created on the Tableau team. Apparently this type of visualization hadn’t occurred to them and it created some excitement. What follows is a combination of what I learned on my own and what Ty helped me to create.
For this exercise, we’ll be relying on some of the training data that comes along with Tableau – the ’superstore data’.
This post is pretty in-depth (and long) but it assumes that you have a working knowledge of Tableau and SQL. If you are new to either or both, some of this may not make sense.
Set 1: Getting Set Up
- Open Tableau
- Start a new workbook
- Connect to “Sample -Superstore Sales” Excel file
You may see some different dimensions and measures in here than what you see in your workbook. There are two reasons for this, there are a couple of custom dimensions and measures that we need to create along the way AND you may have a different version of this file than I do.
Step 2: Building the Calendar Framework
- The first thing we need is a custom dimension, not because we’re going to use it right away but we will need it later for building in some interactivity and it’s part of the calendar framework. this dimension will be called “YYMM” and is a simple concatenation of the 2-digit year and 2-digit month from the Order Date dimension.
This simple dimension is simple a string and will return values like ‘0801′ (e.g. January 2008)
- Setting the stage…
- Right-mouse click and drag the “Order Date” dimension to the Columns pane. This should prompt you to select the type of aggregation to use – select “WEEKDAY(Order Date)”. This will get you your days of the week running across the top.
- Now drag “YYMM” to the Rows pane, followed by “YEAR(Order Date)” (which is the default aggregation for date dimensions), “MONTH(Order Date)” (remember that right-mouse drag?) and “WEEK(Order Date)”
Right now you have a table that should look something like the following:
- Making the table into a calendar
- In the “Marks” pane, change the Marks drop down to “Square”
- Make a new custom dimension called “Day” with the formula DAY([Order Date]) (Make sure that day is in the Dimensions pane and not the Measures pan after creating it)
- Drag “Day” to the “Level of Detail” box in the “Marks” pane
Now the Tableau stage probably looks something like this:
- Let’s put in a quick filter so that we can look at just one month, we’ll remove the filter later. Control drag (CTRL+Drag) “YYMM” from the Columns pane to the “Filters” pane. Put a check mark on “Exclude” and then scroll to the end of the list and take the check mark off of “200812″. Now we’re just looking at December 2008. Still doesn’t look like much of a calendar does it? But it’s in there.
- We just have to manually adjust the size of the stage and the cells to get what we are looking for.
- Find the up/down handle on the Week of Order Date cell and drag it down so that the row height is about 1.5″
- Do the same for the Day of Week Columns. We’re now getting closer, you can probably start to see the calendar format:
- Add borders to enhance the calendar effect. Go to Format –> Borders
- Add a black, narrow border to Cell under the Default section of the Sheet–>Borders pane
- Ass an added bonus you can now fine tune your column width and row height to a square
Your Tableau stage should now look an awful lot like a calendar, albeit an ugly blank one:
-
Step 3: Adding Data and Visual Analysis Cues
So now we have our basic calendar structure but there is no data in it and let’s face it, it’s U-G-L-Y. Let’s start by adding data.
- For the purpose of this exercise, we’re going to assume that we want to keep track of total sales (Gross Revenue) and Profit. We also need to add the day of the month to each cell. Initially, I had gone down the road of using Tableau annotations to create this but it’s cumbersome and breaks whenever the dates change. So the biggest thing that Ty in Sales Engineering helped me with was a custom measure that contained the Day of the Month, the total Sales and the Profit.
- So, we’re going to create a custom measure called “Day Calc” that concatenates the day of the month, the Sales total and the Profit total. The formula looks like this:
str(MIN(DAY([Order Date])))+”
s: “+str(round(SUM([Sales]),2))+”
p: “+str(round(SUM([Profit]),2)) - Now, drag “Day Calc” from the Measures pane to the “Text” field in the Marks pane
- Right-mouse click a date cell and go to Format. Set the vertical alignment to “Top”. Horizontal alignment is your choice, as long as it’s left or right
Ok, now we have actual data in the calendar, but what’s up with the color? The blue ain’t helping – maybe we should do something about that?
- So, we’re going to create a custom measure called “Day Calc” that concatenates the day of the month, the Sales total and the Profit total. The formula looks like this:
- Use color as an indicator of health
- Drag “Sales” from the Measures pane to the “Color” field on the Marks pane
- In the new “Colors” pane that appears below Measures, click the down arrow and select “Edit Colors”
- In the new dialog box, change the palette from “Automatic” to “Red-Green Diverging
- Put a check on “Stepped Color” and change the number of steps to two (2)
The colors, which are splitting on the average revenue in this scenario, are still quite a bit saturated though.
- Change the opacity of the cell colors
Step 4: Cleaning It Up
Now we have a calendar that gives us useful information and visual cues to the health of a particular day – hooray! But there is still a lot of stuff chart junk showing that we don’t necessarily need to show.
Things that can probably be hidden (not removed because they are either needed to maintain the calendar framework or we will need them later to create interactivity).
- YYMM can be hidden
- Week of Order Date can be hidden
These two items can be hidden by clicking on the dropdown arrow in their respective lozenges (yes their called lozenges) in the Row shelf and taking the check mark off of “Show Header”
- Additionally, we can remove the row headers. Right-mouse click on “Order Date” in the stage and select “Hide Field Labels for Columns” – Order Date should disappear. Right-mouse click on either “Year of Order Date” or “Month of Order Date” and select “Hide Field Labels for Rows” and both of those should now be hidden.
- You may want to resize the Year and Month columns at this point but keep them visible because in the next post we’ll be making this calendar interactive so you want to make sure and indicate which month and year is being viewed
- VIOLA! A calendar based view in Tableau:
Stay tuned for the next post in this series where we’ll discuss taking this view and making it interactive!
Tags: calendar view, Tableau, tableau-tips

Hi Clint, I didn’t know you were a new Tableau convert. I love that product and I’m impressed (but not surprised!) with what you’re already able to do. Looking forward to your future posts about Tableau.
Hey Jacques! Yeah, color me converted! Thx. for the props. I am really enjoying Tableau. Can’t wait to get my hands on server
New at Instant Cognition: Tableau Tips: Creating A Calendar Based View – http://is.gd/eSiT
Nice post Clint. Tableau is a great tool and has a lot of nice features. Mix that with your creative and presentations skills and the combo will be really powerful. Keep it coming
Hey Ali – tons of nice features. Really like not being reliant on BI for quick investigation of data. There will definitely be more to come.
Hey Clint, great post! Thanks for stretching the software. Did you consider showing a different time-series view along with this and gradually working your users off calendars?
By the way we gave you a shout-out in our blog: http://www.tableausoftware.com/blog/calendar-data-visualization
Hey Ellie! Thanks for the shout-out.
I’m not migrating users to a different view per se and here’s why:
1. The calendar is used in planning meetings and since these planning meetings tend to revolve around specific events, the calendar works well for that
2. In the next post I’ll discuss the interactive bits that Ty really shone on and we use more purist visualizations of the same/related data. So we have multiple views on the same data that is easy to get to and thus gives a more wholistic picture.
3. As a general principle, I look for visualizations that have the least friction (lower barrier to entry). In other words, bullet graphs are great but they require training someone how to view it. This often leads me to use visualizations that theorists and purists alike will often look down their nose on. I even use the dreaded pie chart (with restrictions) in some cases because a) every MBA in the world is comfortable with them and b) a high degree of accuracy is not required – used most often to answer “Bigger than a breadbox and smaller than a Volkswagon” type questions. (Ok so all you purists and theorists can go hog wild now – I can take it)
I’m throwing cream pie charts at you!!
Mmmmmm. yummy! We should host a contest for the best pie chart – made from pie!
Earlier this week I posted this note on the Tableau blog regarding your calendar view, and wondered if you had any thoughts about it?
Here is an image of a variation on the theme. It illustrates the opportunity to fill cells conditionally based on the values in another field. In this case, the color of each day is based on a calculated field: [Day_color] = MAX([Region]). MAX(Region]) is now also part of Clint’s inventive/mind-blowing original [Day Calc] calculated field, which now reads:
str(MIN(DAY([Order Date])))+”
s: “+str(round(SUM([Sales]),2))+”
p: “+str(round(SUM([Profit]),2))+”
Max p: $”+str(round(max([Profit]),2))+”
“+str(max([Region]))
Best as I can tell, [Day Color] resolves to the [Region] with the MAXimum profit for the [Day] in question. If I am mistaken, it was worth a try. Otherwise, kewl!
This approach might be of some help to Jawon, in answering his question on the Tableau Desktop Basics Forum, which was:
“If I have a variable in the Text shelf, is there a way to conditionally format the background of a cell? For example, I have the State variable in the Text shelf. I want the cell background where State=”IL” to be red. Possible?”
Whaddyathink?
MANY BLESSINGS!
Peace and All Good!
Michael W Cristiani
Market Intelligence Group, LLC
Michael,
thanks for the addition to the work. I can’t take credit for the DayCalc field though – that was one of Ty’s best contributions.
[...] in January, I published a post on how to create a calendar-based view in Tableau. At the time, I mentioned that it had created some buzz within the halls at Tableau-central and [...]