Ryan Sleeper
Unit charts are stacked bar charts made up of individual, and equally sized, units. Since the level of detail must include the dimension members creating the units, you can add extra context via the Color and Tooltip Marks Cards.
Hi. This is Ryan with Playfair Data TV. And in this video, I’m going to show you how to make unit charts in Tableau. Unit charts are stacked bar charts. So they’re made up of individual stacks, but the key is, those individual stacks are all the exact same size.
The one example that I know of to share with you from the Sample – Superstore dataset is with order IDs. So if I wanted to stack up my orders, each order would represent one value. So each stack would be the same value, one unit.
So to start this view, I’m going to right-click on the Order ID field, which will allow me to change its aggregation when I add it to the view. So I’m going to right-click Order ID, drag it to the Rows Shelf, and choose COUNTD. And I’ll break that count down.
So just to point out, we’ve got 5,009 unique orders at this point. But I will now break that down by the Category dimension by putting the Category dimension onto the Columns Shelf. I’ll go ahead and sort this in descending order. So at this point, we have a bar chart. COUNTD Order ID. So in other words, unique orders by category.
To convert this to a unit chart, I need to change the level of detail. And what I need to do is specify what those unique units are. In this case, we’re using Order ID. Each of those order IDs represents the number 1. So I’m going to place the Order ID dimension onto the Detail Marks Card.
And this just got a lot more granular– in fact, so granular that it appears the color of the bars changed. What happened is, they’re still blue– see, if I click Color, I see the blue color. But they’re so close together that the borders are all overlapping, giving it that gray appearance. But notice, as I hover over and scroll down, these are all unique orders.
We technically already have a unit chart, actually, but this one’s not very useful. There’s just too many marks on the view. So what I’m going to do to help illustrate this is drag the Order Date dimension to the Filters Shelf and choose a range of dates.
And maybe I’ll just look at the last week or so in this dataset. So Christmas day 2018 to the end of the year 2018, which is how far the Sample – Superstore dataset currently goes. I’ll click OK.
And now that we have a much shorter range, we just have fewer orders to visualize. And now we can see those individual units. So it’s a stacked bar chart. You’ve likely heard me mention this on other videos.
But stacked bar charts are usually my least favorite chart type because, unless you are the stack on the bottom, it is very hard to compare the trends and/or compare the distinct dimension members across the bar chart. So for that reason, I typically don’t like stacked bar charts.
But unit charts are a little bit different. These are all the exact same size, each of the units, so you can compare their trend. And you can look at it in multiple ways. You can look at the top of the unit chart to know which category performed the best overall. You can also look at individual units.
I should point out both sides of the argument. There are some famous authors, like Stephen Few, who aren’t a big fan of this chart type. At least that’s the latest opinion that I had heard. He released a whitepaper called “Unit Charts Are for Kids,” for example.
His argument is, he thinks that unit charts kind of implore you to slow down and count the number of units in each bar. So he thinks a bar chart is better because you don’t have to slow down. You automatically can use the preattentive attribute of height or length to see what the best performer was.
However, I do like unit charts. And I think Steven Few’s opinion was put out there before tools like Tableau. Because what I like about unit charts is, you can add additional context, and you can get down to that individual unit. So if were looking at orders, you could hover over it and get more information about that via the tooltip.
Let me give an example of some extra information you could provide to this. If I were to put the Profit Ratio measure onto the Color Marks Card. And that’s probably too much color, so I’ll just double-click on this, bump the steps down to two.
And we’ll say, red if below 0 and this kind of neutral blue if above 0. Click OK. Because we got rid of that shading, we’ve lost where the units were. They’re still there, but we need to also add a border to these so we can get the appearance of those individual units back.
But here’s what I was talking about with that extra context. Now I know not only that Office Supplies had the most orders, I can also see how many of those orders had a negative profit ratio. So that’s really important context. On the surface, if we just looked at this as a bar chart, it would look like Office Supplies was dominating the rest of the business.
But then when you take a closer look and add that context, via the Color Marks Card, and because we’ve got those individual units in there, we can now see things like, sure, had the most unique orders, but it also had the most orders with a negative profit ratio.
So maybe you want to dig a little bit deeper before we give the manager of the Office Supplies category a bonus. But that was unit charts in Tableau.
This has been Ryan with Playfair Data TV – thanks for watching!