Data Viz Done Right

March 22, 2016

Tableau Tip Tuesday: How to Create Small Multiple Line Charts


For this week’s Tableau Tip Tuesday, I show you how I created the small multiples line chart of the race for the Republican presidential nomination. These charts are also known as panel charts. These can be quite tricky to make as sometimes you have to play around with the scope of your table calculation to get it quite right. This video should certainly get you started in the right direction.

Here are the two calculations you need to create the column and row dividers:

Column Divider

Row Divider
int( (index()-1)/(round(sqrt(size()))))


  1. Awesome stuff! When I follow this step-by-step, I am getting multiple dimensions per panel. I'm using Tableau 9.2. I've got everything computing by the dimension in the marks card. Not sure where I'm going wrong...I've also triple checked the column and row divider formulas.

    Any ideas?

    1. If I had to guess, you have nulls in your data set, which is what would cause that problem.

    2. I did have nulls, but I cleared those out and still no luck. I created some fake data too and no luck.

      It works when I have the continuous date set to month, qtr, or year. But anything less than month, it puts all of my lines in one box. I really need it to be set on exact date/continuous for it to look right. Thanks for reading!

    3. Zach, can you post a link to a workbook with the problem?

    4. Try this link:

      It's fake data, but same problem persists.

    5. Zach, one thing I noticed about your data set. Some Qcodes have data on a day, that other Qcodes do not. I think these gaps would create a similar problem to having nulls in the data for those dates.

      These differences exist at both the week and day level, but once you get up to the month aggregation level, all Qcodes have month level data, so that's when the divider calcs begin working.

      If your original data source shares these same characteristics, then that's probably the source of the issue.

    6. Interesting! Thanks for the reply Matt. So you're saying that basically all entries need to have the same date-ranges? That's definitely a problem with my original data source -- some values end in December 2015 while others may carry thru January 2016. I can see that being problematic now.

      I should be able to join to a Time_Date_Dim table then and basically assign a "0" value where the date isn't available?

    7. Since I'm still dissecting how the calcs work, I can't say for sure, but I'm pretty sure your solution will work.

      If there are at least nulls existing for every date/review/qcode combination in your original data source, you could use the ZN function in tableau to replicate your Reviews measure via a calc field and transform the nulls to zero's instead of filtering them out. That would save you the join work.

      In trying to understand what's going on under the hood, I recreated the formulas in Excel and based on my generated Column/Row numbers, did a basic quadrant chart showing where the value for that data/date combination would go. Then I made a tableau workbook based on that data set and sure enough, the calcs basically break the plot because different Qcodes are plotting into different quadrants.

      I don't know exactly why your data causes the calcs to break in the exact way seen in your sample workbook, so I'm hoping Andy will chime in and let us know if I'm missing anything :)

      Here's a link to a folder with my example tableau file and excel workbook:

      Hope this helps!

    8. Thanks for the thorough review. I did go back to my source data and applied ZN to my formulas to force nulls to 0 and still no luck. The weird thing is that it appears to work when the date range is discrete (meaning it breaks the Qcodes up into it's 4 respective quadrants). But the discrete dates are clearly counterproductive to what the view is supposed to show.

      I'll keep giving it the ol' college try. Thanks Matt!

  2. Great post! I successfully combined this with the KPI Donut chart post to show building occupancy levels on our campus within one view. Any resources out there to help me understand what's going on with the row/column formulas? I enjoy learning the nitty gritty when I can.

    1. I'm assuming that tableau is drawing the data into the different partitions based on those calcs, but I'm not sure exactly how those formulas helping tableau determine that.

    2. I joined in to help Zach in the thread above which lead me to some thought exercises about the formulas so I think I sorta get it now. Would still love to know if I'm missing anything.

  3. Awesome! I always wondered how to make these small multiples matrices in Tableau. Now I know - thanks so much for sharing!

  4. Hi Andy!
    Great Tableau Tip!
    Simo and I replicated it using Sample Superstore building panes of sales by subcategory by quarter, and stumbled upon some of the issues the other guys here already raised.
    As "Copiers" subcategory didn't sell in the first quarter of the dataset (Q1 2011) the calculations tried to fix it just using Q1 2011 of the following subcategory (causing a translation of all the subsequent values for subcategories in Q1 2011).
    To solve this, we changed the "quarter" tableau date in a string (str((YEAR([Order Date])))+"-"+str(DATEPART('quarter', [Order Date]))), and this works.
    We guess this has to do with densification, and the tendency of Tableau to fill gaps in data when working with table calcs.
    We thought this could have been an interesting use case to add in this space.
    See you soon,
    Simo and Nicco

  5. This post is fantastic. I'm having a bit of trouble giving both the end points a value as well as showing the title at the top of the pane. I've set marks to pain to get the title, but ideally I'd set line ends to 'value' and bring in the title another way (replicating 'Cruz' or 'Bush' at the upper center of the pane).

  6. hi -- this is very helpful. I am 90% there but I can't get the labels (ie like your candidate names) to appear above each graph. What's the trick to that?
    thanks, noah

    1. It's simply a constant line on the secondary axis. Download the workbook and you'll see how I did it.