VizWiz

Launch, grow, and unlock your career in data
Showing posts with label sparklines. Show all posts

October 24, 2022

#MakeoverMonday Week 43 - How have Major League Baseball Pitch Types Changed?

No comments

This week's data set was pretty simple. We had 21 baseball seasons and a column for each pitch type. Pivoting the metrics made it much easier to work with for me as I could then split the view by pitch type.

During #WatchMeViz (below), I create a trellis view, showed how to create groups, sets, set actions, sparklines, LODs, custom number formatting, creating a mobile view, and more.

Thank you for tuning in. Here's the video and below is my visualization.

August 11, 2022

10 Methods for Displaying Variance with Bar Charts

No comments

Using variance as a measure in bar charts helps you:

  1. Add context - You can answer the question “compared to what?”
  2. Make decisions - You can answer the question "what should we do next?"
  3. Alert you to areas that need focus

In this video, I show you 10 ways to add variance to bar charts. Get the workbook here.


November 16, 2020

Visualizing a Profit & Loss Statement with KPI Cards

No comments

Data HAS to be consumed quickly to be understood and to make quick decisions. A "typical" profit and loss statement is on a spreadsheet. However, spreadsheets are notorious for (1) errors and (2) being very difficult to spot areas of concern.

That's where dashboards come into play. Back in July 2017 I proposed a new way to visualize a Profit & Loss Statement (P&L). The dashboard has been very well received and put into practice at many organizations. They've reported back to me how useful it has been. 

But then I got thinking about an even easier way to visualize the data. I felt like the previous version was a bit chart heavy. So, while I've been creating templates for other areas of a business (HR, Social Media, Customer Service), I decided to also focus on a new version of a P&L statement with KPIs. This dashboard is based on a Finance Dashboard example from Excel Dashboard School.

You can download the data I used to build this template here. Click on the image below to interact with and download the workbook.

October 7, 2018

Makeover Monday: Five-year Cancer Survival Rates in America

No comments
It's been an eventful week in America, but irrespective of your politics, this week's Makeover Monday is something we can all feel positively about. Cancer survival rates are increasing!

Here's the original viz:


What works well?

  • Simple title that explains what the viz is about
  • Cancer types are sorted from highest to lowest based on the five-year survival rate
  • "All cancers" is sorted at the top since it's the overall statistic
  • Using arrows to indicate improving or declining
  • Using different colored dots for each time period
  • Including an explanation for how the data came about

What could be improved?

  • The subtitle is long. I had to read it a couple times to understand it.
  • The viz overall feels kind of busy.
  • By using directional arrows, the change over time is lost. The change isn't linear, but the design could be interpreted that way.
  • Color the arrows by increasing or decreasing. Uterus and Cervix Uteri cancer survival rates have decreased, but that could easily be missed.

What I did

  • Incorporatde the change over time
  • Used BANs for the first period and the last period measured and the difference
  • Used a big dot to indicate a reduction in survival rate
  • Used row banding to guide the eye from left to right (taking a lesson from last week's Workout Wednesday)
  • Provided an option to filter by race and gender
  • Used a set to split the view into the top 9 on the left and the rest on the right; my first version was one long viz, but I didn't like how I had to scroll.
  • Used reference bands vertically and horizontally to give the labels space on the ends of the lines

Click on the image below for the interactive version.


February 22, 2017

Tableau Tip Tuesday: How to Add Min/Max Indicators to Sparklines

4 comments
The backlog of videos that I want to create is quite extensive and including min/max indicators on sparklines has been sitting there for a while. This week's #MakeoverMonday by Ann Jackson kicked me into gear.  Thanks Ann!

First, let's have a quick look at Ann's viz:


Notice the sparklines with the indicators on the right. In this week's tip, I'll walk you through how I would go about creating those. The video is under five minutes and easily replicable. Enjoy!

February 15, 2017

Workout Wednesday: Dynamic Trellis Chart

4 comments
For Workout Wednesday week 7, I challenge you to build this dynamic trellis chart. Special thanks to Chris Love for explaining to me why the trellis works the way it does. He has a great blog post series over on The Information Lab blog.

In this example, I'm using the same Superstore Sales I've used in previous Workout Wednesdays. Here are the guidelines:

  1. Match my colors.
  2. The user should be able to choose the level of detail they want for the date.
  3. The date axis format should not change, irrespective of the date level chosen.
  4. The user should be able to pick from the list of dimensions shown.
  5. The dimensions should be sorted from upper left to lower right based on the sales in the most recent time period.
  6. Match my tooltips. Note that they change based on the options the user selects. Pay attention to the date formats in particular.
  7. The title should update dynamically based on the date level and dimension selected.
  8. The end of each line should be labeled to the right of the last point. 
  9. There should be a little circle on the end of each line.
  10. Each section of the trellis should include a label for the value of the dimension for that section. E.g., California should be on the upper left when you selected quarters by state.
  11. The dimension labels should be centered in each section.
  12. There should be no gridlines, but the zero line should be included.
  13. Each row should should have a light divider between them.
  14. My final view is 900x700.

February 14, 2017

Tableau Tip Tuesday: How to Add Space for Labels on the End of Lines and How to Create a Year/Quarter/Month Selector

3 comments
This week is a double tip. First, I take you through adding a buffer to the end of sparklines so that you can have your labels next to the end of the lines. Second, I show you how to create a dynamic date selector, which I then use to create a dynamic buffer for the labels.

February 6, 2017

Makeover Monday: Are We Nearing the Death of Chicago Taxis?

6 comments
Now THIS was a fun week! Eva and Exasol set us up with 105M records to play with. Often time, this can feel like an incredibly daunting exercise, but I took a very methodical approach. More about that in a minute. First, let's take a look at the viz we want to makeover:



What works well?

  • Using a line chart to portray a time series rarely is a bad choice
  • Nice simple labeling of the axes
  • Title tells me what I'm looking at
  • Red line on the grey background works well
  • The y-axis is truncated, but the chart maintains a nice 3x2 ratio so that the line trends aren't too distorted.

What could be improved?
  • Scale of the y-axis is a bit odd; I like nice rounded numbers that make the math easy to do in my head
  • There is SO much more data to work with; why limit to only trips?
  • Could use a more impactful title
  • Could use more context

This week I decide to apply some of the training we received from Rhiannon Fox and do a bit of mood boarding, color choosing and seeking overall inspiration. I knew I wanted to create a summary dashboard of sorts that included lots of context, so after a bunch of Google image searching and pinning, I ended with this mood board.



I started by connecting to all 105M records live because I wasn't sure which dimensions I would end up using. When I finally finished (this took well over an hour), I created an aggregated extract. The trick to this is to hide the dimensions you aren't using before you create the extract and to rollup to the lowest date level in the view (month for my viz). This took the viz from 105M to 299K records. Incredibly, the extract was ready in less than 10 seconds. Exasol is crazy fast!

Overall, another fun week. Tonight I get to introduce this to a bunch of new Tableau users at the #MakeoverMonday Live session at Tableau HQ in London. Can't wait to see what they come up with!


April 28, 2016

Guy Fawkes & Fires: Learning about the UK with Tableau

1 comment

Today I attended an expo at the Devon & Somerset Fire Services with Tom Brown and Robin Kennedy. In preparation for the event I built a few dashboards for us to showcase. A friend of ours over at Surrey County Council pointed me to a dataset about fire incidents in the Greater Manchester area for 2012/13. The beauty of this dataset was that it included the locations of the fires and lots and lots of details about the fires.

Tom asked me to build something, so I started exploring by building lots and lots of visualisations to see if a story stuck out. And one did! When I created a heatmap of fires by month and day, November 4th and 5th jumped right out. That seemed a bit strange to me. I think of those dates as near elections, but here in the UK it the celebration of Guy Fawkes Day and there are lots and lots of fireworks. And, duh, fireworks = fires.

I also noticed some outliers at the beginning of March, which I still haven’t been able to explain, April Fools Day had a lot of false alarms (shocker!), and August 5th and October 27th were near bank holidays, which probably means fires from BBQs.

Yet another fun couple of hours exploring data with Tableau. It was a lot of fun showing these off to potential customers today and also seeing a bit more about the sales side of the company. Great learning indeed!

April 19, 2016

Tableau Tip Tuesday: Using LOD Calcs to Filter the Latest Month and View Sales for the Latest Day


I’ve written before about making the ends of sparklines actionable here and here and created a video here. Each of these uses table calcs to add the dot on the end of the lines. The problem, though, is the method falls apart when the end date on all of the lines isn’t the same. Yes, there are other workarounds with table calcs, but they are overly complicated.

I’ve been wanted to look at this again with level of detail expressions, thinking there had to be a simpler way to create and maintain them, and a way to overcome the drawback listed above. The video below walks through two level of detail expression:

  1. Create a filter using a LOD calc to dynamically return just the latest month in the data set
  2. Return the value of the end of EACH line of a series of sparklines


This technique could easily be parameterized, but for this example, I stick to a single dimension. Enjoy!

March 29, 2016

Tableau Tip Tuesday: How to Calculate the Number of Profitable Days per Month

No comments

This week I begin what will hopefully be a series of videos and tips about Level of Detail (LOD) expressions in Tableau. The more I teach them, the more I learn about them. Many of the example I’ll show will come from the Tableau Community and/or adjusted to expand on the exercise. Essentially, I hope to turn this into a set of use cases for LOD expressions.

This week I show you how to calculate the number of days each month that were profitable. This started with read this post on the Tableau blog. I’ve extended their example to include sparklines, an area chart and using a parameter. Enjoy!

September 1, 2015

Tableau Tip Tuesday: How to Show KPIs & Sparklines in the Same Graph

15 comments
One of my favorite tricks is to create table calculations and make them discrete for showing in the rows and columns. This frees you up to use the other chart types alongside a table.

Back in November, I wrote step-by-step instructions for combining KPIs and sparklines into the same worksheet. With Tableau 9, things have changed a bit in that these are now even easier to create with LOD calcs. In this video tip, I show you how to create these views. Use these and you'll never think about Tableau's lack of synchronous scrolling again.


July 21, 2015

Tableau Tip Tuesday: Create Actionable Sparklines

2 comments
I love sparklines! I think they're a highly underutilized chart type for showing lots of information in a tiny space. But from what I've seen through my years is that people simply create little line charts with no context or call to action.

So this week, I wanted to introduce you to a simple way to create sparkline indicators. Basically all I'm doing is adding a dot onto the end of the sparkline and color-coding it for a call to action.

For more information, here's a blog post I wrote in 2013 for how to create these as well, but I think the video below is simpler.

November 9, 2014

Tableau Tip: KPIs and Sparklines in the Same Worksheet

57 comments
I'm writing this blog post outside of a Starbucks in the Sao Paulo airport.  Sao Paulo you say? I'm in Brazil this week with four other folks from the San Francisco Bay Area TUG to help Tableau leaders in Rio de Janeiro and Sao Paulo get their own TUGs started. I see this as a way that I can give more than I take from the Tableau community. Yes, this is what I choose to do with my vacation time (it's a bit of a sickness) and no, Tableau doesn't pay me to do this.

Anyway, as I was on the plane, I thought it would be great to kick off the week with a new tip. Today, I'm writing about combining KPIs and sparklines in a single view. It's very common for business users to want to see KPIs and trends in the same view. These give them a sense for the overall direction of their product and also highlight the most meaningful numbers to them. I often see people create these as separate worksheets in Tableau, but with this post, I'm going to show you how to combine them into a single view.

Combining them into a single view provides a couple of benefits:
  1. Tableau only needs to render a single sheet, so until parallel processing comes out in v9, you'll see a performance benefit.
  2. If you have a hierarchy, then expanding the hierarchy will keep the table and the sparklines together. 
This example is using a very simple data set of daily volume for several stocks.  My KPIs include:
  1. Trading volume for the last 7 days
  2. Trading volume for the prior 7 days
  3. Week over week change (raw & %)
This should be a fairly typical set of KPIs for most products. You could easily expand this technique to include m/m or y/y calculations depending on how your organization calculates those.  Here's the final solution, with details on how to create this view below.


August 29, 2014

Two-way Sorting in Tableau - Sorting Some of the Viz by a Measure and the Rest Alphabetically

10 comments
I had an interesting requirement posed to me yesterday that I hadn't ever run into before. I'm using this Airline Delays data to demonstrate the technique. The requirements were along these lines:
  1. Given a list of airports, there are a subset that are "targets". Let's assume they are the top 15 with the most flights in 2014: ATL, DFW, ORD, LAX, DEN, IAH, SFO, PHX, LAS, MCO, CLT, EWR, BOS, SLC, LGA
  2. The airports need to be sorted by the latest delay rate.  However, only those in my top 15 list should be sorted by delay rate, the rest should be sorted alphabetically to make them easier to lookup.
  3. Include sparklines for each airport for 2010 to present.
This is the final product and here's how I went about solving this problem. There could very well be a more efficient method, but this worked for me.

December 4, 2013

Tableau tip: Don’t waste the ends of your sparklines…make them actionable!

5 comments
I’ve been meaning to write about how I use sparklines for a while now and the post Two Tips for Meaningful Sparklines in Tableau by Jim Wahl finally gave me the push I needed to get this written.

Sparklines are one of my favorite chart types to include in dashboards, yet I see many people using them without providing enough context.  Some people like to add bandlines, some like to add sets of dots, some like to add text, all in an effort to add meaning to sparklines.  These are perfectly fine, but I think there’s a better way to make sparklines actionable.  Is this the best way? Maybe not, but it is an alternative worth considering.

Sparklines were first introduced by Edward Tufte in his book Beautiful Evidence.  Tufte says: “A sparkline is a small intense, simple, word-sized graphic with typographic resolution.”  Stephen Few expands Tufte’s definition in his book Information Dashboard Design: “Their whole purpose is to provide a quick sense of historical context to enrich the meaning of the measure.  This is exactly what’s required in a dashboard.”

When someone is creating a dashboard, they should provide as much information and meaning as possible to make the information actionable.  I don’t see any examples from Tufte, Few or Jim Wahl that provide much meaningful context to the end of a sparkline.

Tufte provides some examples:

He might add a red dot to the end of the line along with some text to highlight the latest value.

image

While it’s a bit tough to see in this next example, Tufte has used red dots for the beginning and ends of the lines and blue dots to indicate the highest and lowest values.

image

It’s important to also note how Tufte always includes the values associated with all of the highlighted dots.

There are tons and tons of examples of how Stephen Few uses sparklines.  Consider this example from his whitepaper Dashboard Design for Real-Time Situation Awareness

image

Few says: “Meaningful context has been added to these metrics in the form of sparklines, which provide a quick sense of the history that has led up to the present.”  This small section of a dashboard is a classic Few design.  You’ll often see him use (1) sparklines, (2) a visual indicator of health (the red dots in this case), and (3) bullet charts closely together.

When I use sparklines, I like to combine all of the elements of Tufte and Few designs.  Let’s look at an example.

image

On the left you see the sparklines, but notice that I use the dot on the end of the line as an indicator to take action.  Tufte uses the dot one the end to indicate you’re at the end.  Does that make it actionable?  Not necessarily.  Few separates the indicator into its own space and does not mark the end of the sparkline.  My version saves space, increases the data-to-ink ratio, and provides a visual indicator to the reader in one chart.

The table to the right summarizes the sparkline, pulling from Tufte’s practices.  In this example, I’m concerned with comparingthe last two 7-day periods.  Notice how I used conditional formatting so that the dot on the end of the line is the same color as the text in the WoW and WoW% columns.  I don’t use bullet graphs because I feel that the text itself is sufficient; I don’t want to add a graph for the sake of having a graph for everything.

Simple, concise, actionable…all things you want in a dashboard.  Keep reading to see how I built these sparklines in Tableau.

Step 1: The date calculations I use in the example below are simple and efficient when you include a Max Date field in your data source.  Creating Max Date as a calculated field directly in Tableau won’t always work since you need the Max Date at the row level.  In this example, I’ve switched the Superstore Sales data source to Custom SQL and added a subquery to include the Max Date at the row level.

image

TIP: If you have a large dataset, Tableau will run more efficient queries if you push the custom SQL into a view in your database.  Tableau wraps its own SQL around the custom SQL, which can get quite messy and inefficient.  Creating a view will simply the query Tableau runs and improve performance.

Step 2: I like my sparklines to show the last 30 days, so I need to include a date filter.  I include my date filter as the first step so that my data set is smaller to work with from the outset.

image

A Boolean calculation works well here.  Notice how it leverages the Max Date field.  This wouldn’t work if the Max Date was a calculated field inside of Tableau.

image

To get my sparklines to look how I like them, the column and row shelves will need to look like this.  Let’s break the worksheet down into its pieces.

image

Step 3: Create a dummy header and place it on the columns shelf.  Place it on the Columns shelf and hide the fields labels for the columns.

image

Step 4: Right-click-drag Order Date to the columns shelf and choose the first option, Order Date (Continuous).  Notice how it only shows the last 30 days.

image

Step 5: Right-click on the Order Date pill and uncheck Show Header.  This hides the date axis.

Step 6: Drag Category on the Rows shelf and hide the headers.  The headers aren’t needed since they’re on the left side of the table; there’s no need to repeat them.

Step 7: Place Sales on the Rows shelf to the right of Category.  This gives us the lines.  Make them thinner, change the color to dark gray, and resize the chart to make them look like sparklines.

Step 8: Double-click on the Sales axis to bring up the axis options.  Uncheck Include Zero and choose Independent axis ranges for each row or column.  This gives us the view that best fits the space.  Few talks about the scaling options for sparklines in Chapter 10 of Information Dashboard Design.

Step 9: We need a calculated field to show a dot on the end of the line.  You might be tempted to simply turn on the line ends, but that won’t do the trick because you can’t color the line ends only.  The calculated field should only capture sales for the last day.  This is where our Max Date field comes in handy again.

image

Step 10: Drag the new Last Day Sales field onto the Rows shelf to the right of the Sales pill.  Right-click on the Last Day Sales pill and choose Dual Axis.  Right-click on the scale for Last Day Sales and choose Synchronize Axis.  Right-click on Sales pill and uncheck Show Header.

We’re almost done.  All we need to do now is color the dot.


Step 11: I like my dots to be colored by the week over week change.  This requires me to create several calculated fields.  You could combine all of these calculated fields into a single calculation, but I like separating the parts of the calculation to make it easier to understand and so that each calculation is reusable.

Create all of these calculated fields in this order (special thanks to Joe Mako for helping me get these calculations working and showing me why they’re more efficient than what I had been doing):
  1. Last 7 Day Sales:
    IF [Order Date] >= DATEADD('day', -6, [Max Date]) THEN [Sales]
    END
  2. Prior 7 Day Sales:
    IF [Order Date] >= DATEADD('day', -13, [Max Date]) AND [Order Date] <= DATEADD('day', -7, [Max Date]) THEN [Sales]
    END
  3. Total Sales - Last 7 Days:
    IIF(LAST()=0, RUNNING_SUM(SUM([Last 7 Day Sales])), null)
  4. Total Sales - Prior 7 Days:
    IIF(LAST()=0, RUNNING_SUM(SUM([Prior 7 Day Sales])), null)
  5. WoW (week over week):
    [Total Sales - Last 7 Days] - [Total Sales - Prior 7 Days]
  6. WoW %:
    [WoW]/[Total Sales - Prior 7 Days]
Step 12: Click on the Last Day Sales pill on the rows shelf and then drag the WoW % field onto its color shelf.

image

Step 13: Right-click on the WoW % pill, go down to Compute Using and choose Order Date.

Step 14: Double-click on the color legend and change the settings to something like these:

image

You might need to do a bit more formatting to get your viz just the way you want it, but in the end, you’ll want it to look something to this:

image

Notice that I keep the row banding.  I like to include banding on both the sparkline chart and the table so that the reader’s eyes go across the dashboard.

This might seem like a lot of steps, but once you do it a couple of times, it’s pretty quick; you’ll be able to do this in only a couple of minutes.

Building the table is super simple now that you have all of the calculations (this is why I create all of them individually).  Download the workbook here to see how all of this was built.

November 25, 2010

STDs in the USA: Who should you avoid and where?

3 comments

The CDC publishes an annual report on Health in the United States and included in the report is a “Chartbook”.  It’s 574 pages long, but you can skip to page 32 for the start of the charts.  There are some quite horrendous charts, especially the pie charts, that you will get a kick out of. 

You can download the data on CDC Wonder.  Once you create your query, you get a spreadsheet of the results, a map, and a bar chart.  The bar chart is particularly poor and only allows you to pick two dimensions.

I have downloaded the data and produced an interactive dashboard via Tableau Public.  Within this dashboard you can filter by Gender, Age, State and Disease.  In the end, I have included all of the views from CDC Wonder, plus much more. 

Some observations:

  • The infection rate for the total US has continued to climb for all diseases combined.  This is largely due to Chlamydia.
  • Syphilis infection rates declined from 1996-2001, but have continued to climb since.  Particularly concerning is the rate in Washington, DC.
  • In fact, Washington, DC has the highest infection rate for all three diseases.
  • Alaska’s overall infection rate in twice the national average, with the Chlamydia rate 86% higher than the national average.  This is definitely worth looking into.
  • The overall infection rate for females is more than double that for males.
  • Females between the ages of 15-24 are most likely to get infection, while males are most likely between the ages of 20-24.

There are many more observations and insights to be gleaned from this dashboard.  It is considerably quicker to identify outliers and trends with a simple dashboard like this than with CDC Wonder.  Imagine how much more useful the “Chartbook” would be if the CDC used Tableau.

What other observations can you make?