VizWiz

Launch, grow, and unlock your career in data

August 27, 2011

Tableau Tip: 7 easy steps to create a combination chart with overlapping bars & a line

43 comments
UPDATE (13-Sep-2016) - I have created a video tutorial for this tip, which you can find here.

As a follow up to my previous post, which showed how a dual-axis chart looks in Tableau (compared to the Excel version I wrote about in the post previous to my previous post), I was asked by someone named Anonymous (I can never seem to identify him/her) to create similar instructions for building the dual-axis overlapping bar and line chart in Tableau.

Here are the steps I used to produce the chart (there are a billions ways to skin the cat, so take it for what it is):

Step 1: Place the Week dimension on the Columns shelf and the Measure Values measure on the Rows shelf

image

Step 2: Drag the Number of Records pill off of the Measure Values shelf to remove it

image

Step 3: Drag the Units pill from the Measure Values shelf to the right edge of the chart (i.e., the secondary axis).  You know you’re on the secondary axis when you see the dashed vertical line

image

You’re entire canvas should now look like this:

image

Step 4: Right-click on the Units pill, choose Mark Type => Line

image

You’re viz should now look like this:

image

Step 5: Right-click on the Measure Values pill, choose Mark Type => Bar

image

STOP!  Pop the top off that next bottle of Blue Moon.  Double-check your work.  You’re viz should now look like this.  If not, click the Undo button until you get back to a good spot.

image

Step 6: Drag the Measure Names dimension onto the Size shelf

image

Step 7: At this point, the bars are stacked.  So on the Analysis menu, choose Stacked Marks => Off

image

That’s it!  You’re done!  There’s some formatting you could do like adjusting the width of the bars, changing the number format on the axes, etc., but the essence of the chart is now complete.  Seven simple steps in 15 seconds (I wrote 90 seconds in my last post, but I timed myself this time).

image

43 comments :

  1. Cool tutorial! I can use this. And just about 90 seconds to get through it myself the first time - and I'm a slow reader! Thanks

    ReplyDelete
  2. Thanks Mike. I'm glad it helped. I love how the tableau community shares so much witj each other.

    ReplyDelete
  3. Very cool tip. Was going around in circles trying to make a stacked chart

    ReplyDelete
  4. Thanks this is very helpful!

    ReplyDelete
  5. Thank you so much I was doing something with target and sales and was caluclating a value so the total height was correct on the axis

    ReplyDelete
  6. Can you have two measures tied to each axis? I have four measures I want to graph on one graph. Two are in thousands of gallons and two are percentages. I have no problem creating a combo graph with three of the measures and dual axes: the two percentages tied to one axis and the thousands of gallons to another. But I cannot get the second measure in thousands of gallons to blend with its axis.

    ReplyDelete
  7. Thank you! I've wanted to know how to do that for ages - now I feel like an idiot because it's so easy. That's Tableau for you. Cheers!

    ReplyDelete
  8. Hi, thanks for the sharing this information.

    I'm actually facing the same issue with "AnonymousJune 30, 2012 at 7:01 AM" above. I need to show 2 measures in million sales (as bar chart), and another 2 measure in percentages as secondary axis.

    Is it possible to duplicate the "Measure Values", so that both of my left and right axis can have different set of filters for the "Measure Values"? Or perhaps this should be done at different way? Any help will be very much appreciated.

    Thank you!!

    ReplyDelete
    Replies
    1. I believe this blog post answers your question: http://vizwiz.blogspot.com/2013/03/tableau-tip-displaying-multiple.html

      Delete
  9. Great ideas here - the challenge that I have now is to over lay to graphs made from two sets of axes. I have two dates as dimensions and two measures and I want to plot each measure against its own date and using dual synchronized axes, overlay the two graphs. Any ideas> Currently I end up with four graphs (two measure for each date value).

    Thank you.

    ReplyDelete
  10. I have the same issue as Amos: two different date fields and two measures. The date fields cover the same period.
    I can see how it could be done by combining the data before loading it to Tableau to only present one date field with two measures, but I'd rather do it all in Tableau if at all possible

    ReplyDelete
  11. Hi Andy,

    I went through your blog and it really helped me to create a chart with two diffrent shapes on dual axis. But in my next assignment, i faced a similar kind of issue which could not solved. Plz help me on below issue:

    I have a bar chart on primary axis and two line charts using secondary axis. Though, i want one line to change into circle chart. Whenever the line chart is clicked to change into circle, another chart also chnage into circle. As per my understanding, both this line chart is coming from measure group so they can not differentiated by Tableau. I have created bars, lines and dot in single chart of excel. Please assist if it could be possible in Tableau also..

    ReplyDelete
    Replies
    1. Tableau allows for one chart type per axis, therefore you cannot have both a bar and circles on the same axis. However, you can have multiple shapes. If you place Measure Names onto the Shapes shelf, then you can have two different shapes, perhaps one as circles and the other as boxes for example.

      Delete
  12. Hi,

    I am unable to resize the width of bar to two different width, both bars are getting resized, when i tried to increase or decrease size. I am using tableau 8.1 trial. Can you please help.

    Thanks,
    Ranjan

    ReplyDelete
    Replies
    1. Ranjan, when open the edit size dialogue, you can adjust both the smaller and larger sizes.

      http://onlinehelp.tableausoftware.com/current/pro/online/en-us/help.htm#viewparts_marks_markproperties_size.html

      Delete
    2. Similar issue as Ranjan, how can we size so one is thinner and the other thicker?

      Delete
  13. Any suggestions on controlling width of a chart in Tableau? I'd like to see the whole set of data in one view as opposed to having to scroll right to see it.

    ReplyDelete
    Replies
    1. You can choose the View selector at the top and pick "Entire View".

      Delete
  14. How can I keep only one of the two vertical axis, as in my case they are both the same quantity?

    ReplyDelete
    Replies
    1. If they are both the same quantity, then you have two options:

      1. Right-click on the right axis and choose Hide Header or
      2. Drop the pill that's creating the secondary axis on top of the left axis. This will combine them onto a single axis.

      Delete
  15. Very helpful! However, my measures contain a calculated field that doesn't show up on the marks shelf when I drag the Measure Values to the rows. I would like the calculated field as well as two of my measure values to all be different colors.

    ReplyDelete
    Replies
    1. Samantha, you can drag your calculated field onto the Measure Values shelf that appears.

      Delete
  16. Thanks for posting this. I am having the same problem as a few others - can you make a two combination graph with dimensions rather than measures?

    ReplyDelete
    Replies
    1. Can you be more specific on what you're trying to do? What do you mean by "a two combination graph with dimensions"?

      Delete
  17. Can you have two measures tied to each axis? I have four measures I want to graph on one graph. Two are in thousands of gallons and two are percentages. I have no problem creating a combo graph with three of the measures and dual axes: the two percentages tied to one axis and the thousands of gallons to another. But I cannot get the second measure in thousands of gallons to blend with its axis.

    ReplyDelete
    Replies
    1. No Tableau does not support that. Why not two separate charts if you have so many measures? You're readers will likely be confused.

      Delete
  18. Could I compare two dimensions to each other using a line or bar graph in Tableau 8? I am currently just creating to bar graphs, but would like to see both dimensions in one bar/line graph. E.g. Would like to compare survey results for two different surveys with the same rating values. Survey 1 Satisfied to Survey 2 Satisfied; Survey 1 Dissatisfied to Survey 2 Dissatisfied; Survey 1 Somewhat Satisfied to Survey 2 Somewhat Satisfied, etc. My measure would simply be the number of records for the satisfaction survey score.

    ReplyDelete
    Replies
    1. Charlie, you could do one bar inside of another bar. Or use dots.

      Delete
  19. Hello. Is there a way to select a chart that you need from a drop down menu and not get blank areas on the dashboard? As I have it right now, I have a drop down menu that selects which of my charts are visible. However, the charts are side by side in the dashboard so that when I select one of them, there is simply blank space where the other two reside. Is there a way to organize the charts on top of one another so that I can eliminate the unaesthetic areas of my dashboard? Any assistance would be greatly appreciated. Thanks

    ReplyDelete
    Replies
    1. There are a few different ways you can accomplish this. Refer to these posts:

      Change the chart type of a single chart with a parameter - http://vizwiz.blogspot.co.uk/2013/10/tableau-tip-change-chart-type-of-single.html

      or via Alan Smithee Presents

      Changing Viz Types with Dashboard Containers and Parameters - http://www.alansmitheepresents.org/2011/03/changing-viz-types-with-dashboard.html

      Delete
  20. Hi Andy
    I'm so excited that I succeeded in following your instructions to make a combination graph. I am reporting data on 2 measures of literacy from 2nd-5th grade over two years. The bar graphs are overlapping so they don't show the grade performing the lowest! How can I have my bars look like yours with different widths or have grouped together?
    Thanks so much,
    Joy

    ReplyDelete
    Replies
    1. Joy, without seeing your workbook, I'm guessing that you need to put measure names or grade on the size shelf.

      Delete
  21. hello i want to find the how many 1's and how many 0's are presenting the achievement score column . i want the calculation field

    ReplyDelete
  22. for example achievement score
    1
    0
    1
    1
    1
    0
    1 etc i want to count the how many 1's and howmany 0's

    ReplyDelete
  23. Is it at all possible to make the overlapping bars without the line??

    ReplyDelete
  24. This helped me so much !!! Thank you because my chart kept doubling my axis instead of overlaying the data on top. Stack marks had to be turned off in my case

    ReplyDelete
  25. Hi, I have a variable category from 1-4 and corresponding sales values that I would like to sum up. It's easy to plot 1,2,3,4 and their sales in bar chart. How can I plot this . Sales of 1-4 on one bar and 2-4 on next, 3-4 on next and 4th one with sales of 4th category? Please help?

    ReplyDelete
  26. thanks for the tutorial, how do we show both the bar and line chart on single axis?

    ReplyDelete
    Replies
    1. They're not on the same axis. Watch the video that's linked at the top or follow the steps outlined above or download the workbook.

      Delete
  27. Hi Andy, I have a requirement to create Dual Combination chart in Tableau which has 5 measures by Quarter.
    Out of 5 measures we need to have 2 with bar graph and 3 line graph. Using Dual Axis and other workaround we are use maximum of 3 measures like 1 or 2 bar chart and another 1 for line chart.
    Is there a way to achieve this requirement? In Microsoft Excel we have Chart Type of 'Combo Chart Type' with Custom Combination to choose how many ever columns you want them in Bar Chart or Line Chart.

    ReplyDelete
    Replies
    1. First, a chart with 5 measures will be impossible to read. I would suggest creating one chart for the bars and one for the lines. To answer your question, you would need to use measure names twice which you can’t do if they are different measures on each shelf. That’s by design so people don’t create charts like you’re suggesting. You really should push back on the stakeholders.

      Delete