April 18, 2014

Chart makeover: Business Insider’s Ringed Donut Chart

It was April Fools’ Day. I was reading a chart from Business Insider with the bold title “The Mobile Web Is Dead, It's All About Apps” and I thought for sure they were messing with me.

They published this chart that I could only think of calling a ringed donut:

I pondered…Are they messing with me on purpose? Are they taunting me? But then I remembered that it’s Business Insider and nearly of their charts are terrible. I studied the chart for a few minutes before I even noticed that there was the black ring around the donut that summarized the slices of the donuts. Whoa, that’s confusing! And besides, who would ever slice up a tasty donut?

I re-created the data in Excel (get it here) and created this version with Tableau for Mac.

image

Ah, much better!

Notice that I kept the bars at scale across Apps and Browsers; this helps to emphasize how little time people spend on mobile browsers. And if you look at social apps, you can see that people spend way more time on Facebook than Twitter. I’m just sayin’!

Download the workbook here (requires Tableau 8.2).

April 12, 2014

Tableau Tip: Moving reference lines behind bars

Reference lines are wonderful. If done well, they can add so much context at a glance with very little effort to include them in your viz. However, reference lines in Tableau always sit on top of the rest of the viz. We may not want them to be so prominent though.

Wouldn't it be great if we could place them behind the bar, kind of like how you can decide which objects to move backwards on a PowerPoint slide?

First, let's build a simple bar chart of Sales with a reference line for Budget Sales.

2014-04-12_00-30-50

If we click on one of the reference lines and then right-click, we don't have an option to move the marks to the back.

2014-04-12_00-35-43

There's a super simple trick to move the reference lines to the back...Gantt bars!

April 9, 2014

Tableau Tip: Analyzing Year over Year Trends with Table Calcs

UPDATE – 10-Apr-3014:

I received some feedback from both Jonathan Drummey and Joe Mako about this blog post and some of its inaccuracies.  There are a couple of key notes:

  1. My intent was to show how you can compare the 7-day averages of two time periods. In this example, I’m calling this a Year over Year calculation, but really it’s a comparison versus 365 days ago. Small, but important distinction.
  2. The Superstore Sales data set has days that are missing, so unless you turn on domain padding, you won’t be comparing the prior 365 days that you’re expecting to compare. I’ve updated the post below.
  3. Like most things in Tableau, there are many ways to solve the same problem. Joe pointed out some things he would have done differently with the calculations. While neither of us is wrong, note that you should always look for ways to be more efficient.

April is #TableauTipsMonth, so I thought I would pick something from my backlog and get to it. Today I’ll be writing about a fairly typical scenario:

  1. Your data is cyclical through the week
  2. Daily numbers vary wildly, so smoothing is necessary
  3. You need to compare to the same period from the prior year

This can be handled pretty easily and understandably with a few table calculations. To start, let’s look at daily sales for 2013 in the Superstore Sales data set to illustrate the wild nature of daily data that many of us see.

image

This data set looks like it might be cyclical, so let’s apply a 7-day average calculation to it. We could do this via the quick table calculations on the pill, but we will want this calculation for later. Right-click on Sales in the Measures pane and choose Create Calculated field. Build this calculation:

image

Here’s what the chart looks like if I filter Order Date to 2013 on the Filter shelf (I’ve focused in on January):

image

Since I have filtered the year of Order Date to 2013 by dragging the Order Date pill onto the Filters shelf, Tableau first ran a query that returns only results for 2013 and then it will do the 7-day average calculation. We don’t want that because the first six days of 2013 will be wrong. They are wrong because they don’t contain a full 7-day date range.

To fix this, we need to change the calculation. Notice that I’m not passing a filter to Order Date inside the calculation. By passing the filter in the table calc, Tableau will return all of the data for all years, then the table calc will running after the database query, which will then provide the full date range for the 7-day average to calculate correctly.

image

And this is what the chart looks like if filter the data via the table calculation (of course you have to remove Order Date from the Filters shelf):

image

Quite a different story. The lesson here is that you need to understand how Tableau is filtering the data. Anything on the Filters shelf will filter the data before any table calcs are performed.

One thing to note, though, is that this data set does not include all dates. Therefore, we need to turn domain padding on by right clicking on the Order Date pill and checking the “Show Missing Values” option. Notice how there are now gaps in the line; that’s because Tableau is filling in the missing dates for us.

image

So that covers our 7-day average. To calculate the 7-day average for the same 7-day period 365 days ago, we only have to make a simple adjustment to the 7-day average calculation we’ve already created.

image

The only change is the start and end period inside the WINDOW_AVG function. Now drag the new measure onto the same axis as the 7-day average.

image

So now we can see how the 7-day average on an day compared to the 7-day average 365 days ago. Perfect!

Now that we have these two table calcs, we can easily compute the change between the two dates periods with another calculated field:

image

Drag this new measure onto the Rows shelf. Clean it up a bit, and we now have a nice view that answers a simple question: How are sales performing compared to last year?

image

Notice that I used an orange-blue color palette for the comparisons to the prior 365 day values. This is a good practice to employ because the colors corresponding with the colors for each line. If the bar is orange, then last year performed better and vice versa.

Download the workbook used in this example here.

March 25, 2014

2 second poll: Yes or No? Tableau's #1 priority should be addressing performance.

In my opinion, Tableau should drop all features it plans to spend resources on in favor of fixing performance. We should expect visualizations to draw significantly faster than they do today; our users should not have to wait.  For example, if you have a dashboard with 10 worksheets using the same data source, even if the query returns in one second, Tableau will still take 10 seconds to render this viz.  For me, this is unacceptable and needs more focus.  As users we should demand features like parallel processing and faster rendering.

I'm curious to know if others share my opinion.  I have an opportunity to share my feedback with Tableau in a couple of weeks and your responses will help.

March 13, 2014

The Greatest Tableau Tip EVER: Exporting CSV made simple!

We’ve all heard this question before: How can I export a CSV in Tableau?  To be honest, it’s quite the pain and way more difficult than it should be.  There have always been a few options.

  1. Users can click on a specific sheet on a dashboard and then export that via the tiny button on the toolbar, but that has a few of its own problems: (1) You may not want to show the toolbar therefore making the export impossible, (2) People have to be trained to know exactly where to click to get it just right, and (3) You have no control over the output of the CSV.
  2. You can export a CSV using Tabcmd, but that’s not useful for the average dashboard consumer.
  3. You can add .csv to the end of the URL like http://[Tableau Server Location]/views/[Workbook Name]/[View Name].csv.  But again, you never know what that output is going to look like.

Yesterday I learned an incredibly valuable trick that would make option 3 (adding .csv to the URL) export exactly the CSV you want.  Let’s look at an example.

 

February 18, 2014

Makeover - Chart of the Day: The Seattle Seahawks are one of the NFL best defenses of all-time

Cork Gaines of Chart of the Day has once again provided me with a terrible chart to pick apart.  The idea behind this chart is simple, but the execution is nothing short of terrible.  Let's start with the chart Cork produced:

Image

I like Cork's idea: How did the Seahawks defense rank against the best defenses of all-time?  His primary method of measurement is how each team compared to the NFL average.  Makes sense.  

However, there is way too much going on in this chart to make any sense of it.  

  1. Cork chose to show two measures.  This confused me.  Do all of the teams make up the top 15 in each of these categories?  I doubt it.  It turns out that the measure he's ranking them on is PPG allowed vs. the NFL average.  So why include YPG allowed? 
  2. Why show 15 teams?  Showing the top 10 makes it easier to find where the Seahawks rank.
  3. The point of the article is to highlight the Seahawks, yet he fails to highlight them.  You have to do too much work to find them.
  4. The teams are ranked in reverse order.  For some reason, nearly every chart that Chart of the Day produces is sorted backwards.  I suspect they’re using Excel to create their charts.  The best team should be on the left, not the right.  If you don't pick up on that, you might be led to believe that the 2005 Bears had the best defense, when in fact it's the 1975 Rams (who are way over on the right).
  5. He's barely highlighting the teams that won the Super Bowl with a tiny asterisk.
  6. The chart forces you to turn your head 90 degrees to the right to read the labels.
  7. Is the axis needed?  All of the bars are labeled, so I would say no.

I'm sure there are some other things I'm missing, but I'm too irritated with this chart to continue to make myself suffer.  

Since I'm in the process of testing Tableau for Mac, I decided to build my version of the chart there.

NFL Best Defenses

How did I address my concerns with Cork's chart?

  1. I decided to only show PPG allowed vs. the NFL average.  I wanted to keep it simple.
  2. I’m only showing the top 10 teams.
  3. The point of the article is to highlight the Seahawks, which I've clearly done.
  4. The teams are ranked in the correct order, starting with the best defense on the left.
  5. I decided to highlight the Super Bowl winning teams by showing the Lombardi Trophy.  This makes it easier to see that having a great defense does not guarantee the title.
  6. I've made the team names much easier to read by displaying the text horizontally.
  7. The bars are labeled and they all start at zero, so I've eliminated the axis.

It saddens me to see the consistently poor output from Chart of the Day.  They have so much interesting sports data to work with, yet they continue to communicate their stories so, so poorly.  Maybe I should send Cork a copy of Data Visualization: A Successful Design Process by Andy Kirk and/or Show Me the Numbers by Stephen Few.

February 3, 2014

Tableau Tip: Make great looking band lines with area charts

When I was in Israel last week, we wanted to create a visualization that included band lines based on confidence intervals in the database.  In other words, our table contained two measures: value and confidence interval.

Allen Smithee had created some interesting looking Bollinger Bands before, so I started there.  I downloaded the workbook and noticed that while these look decent, they’re not perfect.  This is the initial view:

image

Looks pretty good.  But when you remove the lines for the upper and lower bands (or if you zoom in), you will see that the bands were made via reference bands for each discrete date, which makes them look like bars.  I suspect the lines for the upper and lower were included to hide the rough edges of the bars.

image

Here’s how he created the reference lines:

image

I don’t think this looks polished enough, so I took an alternative approach: area charts.

January 31, 2014

A map is better than a table: When is it best to buy gas in the USA?

If you want to find the cheapest gas in your area, you should check out GasBuddy.  A couple of days ago on their blog they published a simple study they did that includes a table for the best times to buy gas by state.  This table is great for looking up your individual state, but it’s impossible to see any patterns in the data.

I recreated the data in Excel and opened it up in Tableau.  The first thing I noticed is that the data seemed too sporadic for me, so I took the liberty of grouping the data into four buckets: Early week, mid-week, late-week and the weekend.  In less than 5 minutes, I had this map.

Now it’s much easier to see that in the majority of the US, you’re going to find the cheapest gas on the weekend.  It’s much tougher to discern that from their table.  Click on the color legend or the table to highlight.

January 24, 2014

Tableau Tip: Showing all dates on a date filter after a Server refresh

As I was preparing for my trip to Israel, the team posed an excellent question: Why doesn’t the date slider quick filter automatically show the latest date when the data is refreshed on Server?

I saw on this thread that it’s still an unsolved problem.  In a nutshell, here’s a summary of the problem:

  1. You created a dashboard that has a date slider quick filter and you’ve told Tableau to use all dates.
  2. The next day when the data source refreshes, the quick filter doesn’t automatically include the new date(s).  The slider has to be manually moved to the right to accommodate for the new data.

I didn’t have an immediate solution, so I did what I always do when I’m stuck…I asked for help!  That’s right, Zen Masters don’t know everything.  In fact, I don’t know anywhere near everything about Tableau.  I contacted my good friend Joe Mako and he graciously hopped on a join.me with me.  What I truly love about Joe is that he’s incredibly patient and wants to make sure that we work through problems TOGETHER.  Sure, he could have simply sent me a solution, but he wanted to make sure I understood completely.

Let me first explain the problem in a bit more detail.  Assume that you have a set of sales data for the first few days of the year.

image

And you built a cool dashboard with a date slider like this:

image

You publish the dashboard to Tableau Server and set the data source to refresh each night.  But when you look at it a couple of days later, you notice that the chart hasn’t changed.

image

January 22, 2014

The Victors & the Quitters: Who completed the 30-day pushup challenge?

During the first week of December, I posted a question on Facebook asking who might want to do a 30-day pushup challenge.  I didn’t expect very many takers, however 33 people took on the challenge.  The challenge seemed simple: 100 pushups per day for 30 days.  But it wasn’t as easy as it seemed.  Only 3 of 33 completed the challenge. 

How did everyone do?  Check out the viz below to find out.