Why Vizioneer?

My photo
Atlanta, Georgia, United States
The "Vizioneer" comes from mashing two words that have shaped my world for most of my adult life - Engineer and [data] Visualizations (or Vizes to those who know what's up). Graduating from first from Oglethorpe University in Atlanta, followed by Georgia Tech with my Bachelors and Masters in Civil Engineering, all of which taught me to think through anything and everything - problem solving, "engineering" solutions, teaching to the "ah ha" moments - is what I love to do. In 2010 that investigative, engineering mindset intersected a job change and a plunge into the world of Data Analysis. In the search for the next great thing I stumbled on to a data visualization and dashboarding product called Tableau software and things just took off. So now I guess you could call me that engineer with the sweet data visualizations - or just "The Vizioneer" :)

In 2013, I joined the incredible team at Slalom, focusing on Tableau and it's been an amazing experience. Recently in 2014, I was honored and humbled to receive Tableau's highest recognition of being named a Tableau Zen Master. Follow along to see what happens next :)

Saturday, April 26, 2014

Day 26: Chart Type Switching

We're close now.  Can you feel it?  You know who's feeling it? Steven Carter - busting on to the scene as a two time Viz of the Day winner up at Slalom New York.  Steven quarterbacks over on his blog at Monday Morning Viz, and if you couldn't tell by the blog name, he's a huge sports fan.  Today, Steven's sharing his all time favorite trick as I present Day 26: Chart Type Switching - Enjoy!

As an avid sports fan, I could not have been more jealous and disappointed in myself that I was not clever enough to come up with the idea for Tableau 30 for 30 on my own. Imagine my excitement when my colleague, Nelson Davis, asked me if I would be interested in writing a guest post. I quickly accepted with one condition… I had to be able to write an article on my absolute favorite Tableau trick of all time. This one comes with a disclaimer people, your audience’s mind WILL be blown, so use it carefully. Today I’ll be showing you how you can use a parameter to switch between worksheet types in your dashboard. This one has been covered elsewhere, but no list of Tableau tips is complete without it! I was first introduced to it over at Alan Smithee Presents, check out his blog here: http://www.alansmitheepresents.org/2014_03_01_archive.html 

Your first step will be to create a couple of worksheets. In my example, I've just used the Superstore data set to create a simple bar chart and bullet chart showing the relationship between sales and profits by region. Feel free to create whatever worksheets you want, the steps will be the same. You may just want to replace “Bar” and “Bullet” with values that make more sense for what you've created.

After throwing together a couple worksheets, create the parameter below:

Place your worksheets on a dashboard and make sure the worksheets are in a vertical container. I’m using a black border to show the container and how both worksheets should fit inside.

Here comes the magic. You will now create a calculated field that takes your Chart Type Selector as an input. The formula below is a quick and easy way to create your calculated field.

CASE [Chart Type Selector]
WHEN 'Bar' THEN 'Bar'
WHEN 'Bullet' THEN 'Bullet'

Edit: Zen Master Mark Jackson pointed out that the Case Statement isn't necessary.  The same thing would be accomplished creating a calculated field that simply contained the parameter, as below:
[Chart Type Selector]
Great catch Mark! 

Now, on your bullet chart, right click on your “Chart Type Selector” parameter and select “Show Parameter Control”. Set the value to “Bullet” and drag your “Chart Filter” field to the filter pane and check “Bullet”. Do the same for your bar graph work sheet, set your parameter to “Bar” and then add “Chart Filter” to the filter pane and check “Bar.”
Your bullet chart should now be completely blank and your bar chart should show up normally. Exactly why this works can be a little confusing without taking a look at the underlying data. The below screenshot shows the resulting data when the parameter control is set to “Bar”. You can see that when you select “Bar” in your parameter the values for the Chart Filter field become “Bar” for all records. Because you filtered for “Bullet” on your bullet chart, there’s nothing for that worksheet to show!

After you've added your filters, go back to your dashboard. If your parameter control is still on “Bar” it should look something like this:

Now I know what you’re thinking…Steven this looks ridiculous and I hate you! Settle down folks, we’re not done yet. This step is the easiest, but probably most commonly missed thing I see with people implementing the chart selector. Click on both of your worksheets and check for that rascal of a tack. Clicking the tack will take away “Fixed Height” from your worksheet and allow it to resize automatically.

After setting your worksheets to resize it should look something like this:

This still looks a little bit ridiculous, we don’t want to see the “Bullet Chart” title when it is not selected. Right click on the title and click “Hide Title”. If you don’t want a title to ever show, then do the same for bar chart. If you want the title to reflect your parameter choice, double click on the title of your top worksheet and enter something like the following:
Superstore Sales <Parameters.Chart Type Selector> Chart
If you’ve done everything properly, you should have a dashboard that allows your user to select how they want to see the data. Notice that the color legend is even nice enough to disappear when viewing the bullet chart!

This is a useful trick for sure, but don’t get too carried away with it. Each worksheet leaves about 5 pixels of blank space when it is not selected. This is pretty subtle when using 2-3 worksheets, but can become more obvious as you add worksheets to the container.
For more tips and tricks like this, please check out my blog at http://mmviz.blogspot.com. You can see the chart selector in action on my “Road to the National Championship” viz here: http://mmviz.blogspot.com/2013_12_01_archive.html. Notice that the y-axis in ranking worksheets are in ascending order, while the rest are in descending order. Also, I show a % for the Time of Possession charts. Three different worksheets and you wouldn't even notice if I hadn't told you!

Hope you all enjoyed today’s tip and come back to see what else Nelson has in store for you in the rest of his Tableau 30 for 30.

Thanks for checking us out.  Hasta Manana! 


No comments:

Post a Comment