Data Visualization Just Got Sweeter

When creating data visualizations in Tableau, twenty-four different charts, graphs, tables, plots and maps are provided to help you see and understand your data. One of those visualizations is a bar chart. Bar charts are one of the most common ways to visualize data because the end user can quickly compare trends across different categories. Bar charts are great, don’t get me wrong, but sometimes they can use a little “eye candy” to help them (lolli)pop. That’s right. I went there.

Here are the step-by-step directions to create a lollipop chart and then I’ll show you another neat trick which is how to filter the bar chart using parameter controls. I will be working in tableau 9.0 using the data source “Sample- Superstore” provided in tableau.

  1. For our example, let’s look at Sales broken down by Region in our data source. First, let’s drag sales into the rows and Region into the columns.

Image 1

  1. Now we have our basic bar chart showing the Sales for each Region. Now lets get to making our lollipop chart by creating a dual axis. Hold down the Control key on your keyboard and click and drag the sum of sales in your rows to the right and unclick so that it looks like this:

Image 2

  1. Now right click on the second sum of sales and click on dual axis and then right click on it again and unselect “show header”.

Image 3

Now we have something that looks like this:
Image 4

  1. You see that in the Marks card we have three options now: All, Sum(Sales), and Sum(Sales) (2). To make the stick of the lollipop lets change the Sum(Sales) mark type to bar and click size button and move the slider all the way to the left to make it as thin as possible.

Image 5

  1. Then move to the Sum(Sales) (2) card and change the mark type to circle, click on the label button, click “show mark labels” and then change the label appearance alignment of vertical to “middle”.

Image 6

  1. Then click on the size button and drag the slider to the next tick mark on the right so that the label is inside the circle shape.

Image 7

  1. Now we have our basic lollipop chart. We can go ahead and drag reigon into the “All” Marks card and drop it into color to get this:

Image 8

Pretty cool huh? But what if we wanted to see the sales for states within these regions filtered by the top number of states? No problem. Let me introduce you to a good friend of mine: Parameters. Using parameters in tableau is useful because is gives you a way to dynamically modify values in views.  In instead of setting a filter manually and statically behind the scenes, parameters allow the end user to easily change the number of top subcategories within a category.

  1. First let’s change the angle at which we view these data by clicking the swap button on the top toolbar or by pressing Ctrl+ W. then drag the “State” demension right next to Region in your Rows.

Image 9                                                                                        Image 10

We now have a long list of sales figures for each state broken down by region:
Image 11

  1. Now let’s create the parameter. Move your mouse down to the Parameters section in the data pane and right click in the white space below the two parameters and select “Create Parameter”. Change the settings as below:

Image 12

  1. Right click on your newly made parameter and select “show parameter control”. Now you have the controls to the side of the visualization; however, there are two more steps we need to do in order for this control to work: 1) we need to create two calculated fields and 2) use them within the visualization.
  2. To create a calculated field, click Analysis, then “Create Calculated Field”. Name the first calculated field “Rank” and type in “INDEX()” in the text field below. Click OK.

Image 13

  1. Create another calculated field, name this one Filter on Top States and enter “[Rank]<=[Top States]”. Click OK.

Image 14

  1. Now let’s convert “Rank” to discrete by right clicking on “Rank” and selecting “Convert to Discrete” and drag Rank and drop it in between Region and State in the Rows.

Image 15

  1. Right click on “Rank” in the Rows and click “Edit Table Calculation”

Image 16

  1. In compute using, select “Advanced” and set up the calculation as follows:

Image 17

  1. Then set up the calculation definition at the level of State and restarting every Region. Click OK.

Image 18

  1. The last step is to drag and drop “Filter on Top States” in to the Filter Card and select “True”. Click OK.

Image 19

BAM! Now you can move the Top States parameter control slider and it will filter down to the top number of states in sales displayed in the control.
Image 20

Feel free to play around with other settings as well to make your chart as sweet as it can be.

Image 21

As always, if you have any questions about this tutorial or Tableau, reach out to our consultant Matt Winter: [email protected]

Learn more about our Tableau Training and Support services or contact us for a demo of Syntelli Services:

Data Analytics Demo

Matt WinterMatthew Winter
Data Scientist
About Matthew: Matthew leverages Business Intelligence tools with his background in Educational Measurement to empower businesses to make data-driven decisions. Recently, his work has been focused in the banking industry analyzing, interpreting, visualizing, and presenting workforce data from over 8,000 employee assessments.

Matthew received a B.A. in Chinese language and literature from California State University Los Angeles, an M.A. in Chinese language pedagogy from Indiana University, and an Ed.M. in Applied Linguistics, Second Language Assessment tract, from Columbia University, Teachers College. Matthew is certified as a Desktop 9 Qualified Associate in Tableau.