Monday, April 28, 2014

Making a Reusable Tableau Table Contents

 
There are lots of examples in the Tableau Community of how to build and use tables of contents (TOC) for navigating between worksheets and dashboards. Lately there has also been some discussion on the Tableau forums and ideas sections about making this easier. Whenever I read these I think of Tbeleau Co-Foiunder Pat Hanrahan's oft quoted maxim, "Easy is hard," or "Easy is hard, right?" Then I immediately appreciate the hard work all the gracious Tableaurati share to make all our lives easier and simpler. What that in mind, I have been thinking about a flexible way to do Tables of Contents and navigation controls. Here are my thoughts. I used the Super Store data source that comes with Tableau.  The workbook I came up with is on Tableau Public and is embedded in this post. It is not a finished, shiny thing, but just enough to illustrate the concepts.

The Challenge

During a challenge developing TOCs and navigational controls for a use case in my day job, I wondered if it would be possible to use a separate data source for the TOC that had no direct relationship to the the primary and any secondary data that underlies a visualization. One thing that makes this idea attractive is that the data source sits alone. No calculated fields in a primary or secondary source. So, colleagues who have access to the underlying data won't have reason to ask, and I won't have to answer, this question, "What is that "Go to xxxx" column in the data, and why is it populated for every record?"

Requirements
  • Make the TOC data source independent of any primary or secondary data sources.
  • Make the contents of the TOC labels easy to manage and change.
  • Allow the data source for the TOC to support TOC navigational controls.
  • Provide a way to incorporate standard tool tips or flexible ones, depending on the use case. This includes the ability to insert data from a view or dashboard into the tool tips.
Step-by-step

The first step is building a framework for the database.  In this example, I was in a hurry, so I just made up a little .txt file that looks like this:
 

This works perfectly fine with a table you can put together with your favorite data source type (Excel, Access, SQL based table, etc.)

The item field will be used to filter the text label of the TOC entry.
The text field is the actual text label that is displayed in the TOC entry. Note that the text for item 7 is "View ToC". 
The tooltip field is an optional field that holds any predetemined instructional text associated with a TOC entry.
The optional type field identifies what kind of use the record is intended to fill.

The example listing is just that, an example. This data source can have as few or as many records as necessary. Obviously, it can change on the fly, as well, as more TOC entries or instructional tool tips are required.

The second step is to connect to this data in Tableau using the appropriate connector. In order to make this Tableau data source available to others and facilitate it's standardization, I extracted it.

The third step is to make the individual TOC entries. Follow this process:
  1. Select this data connection, then start a new worksheet(Ctrl+M).
  2. The item' field in the data source is a record id. To see how the ids relate to the TOC text, drag item, text, and type to the Row shelf to make a reference table.
  3. Start another new worksheet. Drag the item dimension to the Filter shelf, and select just one of the values, for example, 2.
  4.  
  5. Drag the 'text' dimension to the Text shelf.
  6. To help with formatting, I added a calculated dimension named 'header', and set its literal value to ''.
  7. Drag the 'header' dimension to the Row and Column shelves.  Right click on one of these and uncheck Show Header.
  8.  
  9. Choose Format | Borders from Tableau's menu, then set Row and Column Dividers as desired.
  10. Chose Format | Shading, then set the Default Worksheet shading as desired.
  11. Choose Format | Font, then set the Default Worksheet font as desired.
  12. Duplicate the worksheet to preserve this formatting.
  13. On this duplicated worksheet, edit the item dimension filter on the Filter shelf by selecting another single one of the values. This will change the text displayed in the new worksheet.
  14. Repeat step 10 and 11 in this list as necessary. Be sure to include a worksheet that filters to the View ToC item, in this case, filter item to 7.
The fourth step is to make the Table of Contents dashboard, as follows:
  1. Make a new dashboard and set the height large enough to hold all the TOC entries. Give the dashboard a name, like "Table of Contents" or "Navigation Menu"
  2. Add a vertical layout container to the dashboard.
  3. Add the individual TOC entry worksheets to the vertical layout container in the order needed. See if you can spot the joke in the dashboard image below.
  4. Add filter actions to the dashboard that target the dashboards or worksheets of interest. For each action, be sure to clear the check boxes for the component sheets on any target dashboard. Also, set the target filters to Selected Fields, but add no filters.
  5. Set Run action on to Select.









The fifth step is to add the View ToC worksheet to any dashboard that requires a one click return to the Tableau of Contents dashboard itself. Each of the sample dashboards in the embedded workbook have this sheet included. Here is an example:


Since each TOC entry is a worksheet of its own, each can have its own tool tip if necessary. One way to facilitate this is to include the text of any tool tip in the TOC data source. In this example data source, the field. 'tooltip" serves this purpose.  For example, here is the data source that drives the TOC content. Note that the 'tooltip' field has the value 'Go to Bar Graph Dashboard'.

 
 
The Tableau Public workbook has some other thoughts in it about how to use this independent data source idea. 
 
Please offer your comments or suggestions for improvement.




     



P.S.
First I did some research, checking out a number of table of contents and navigational controls examples from Tableau Zen Masters Joe Mako, Steve Wexler, Craig Bloodworth, Andy Kriebel, Ryan Robataille, Kelly Martin, Jonathan Drummey, Ramon Martinez, Alan Smithee and others. The most common solution was one with which I was familiar -- usng calculated fields to hold text that could be used in conjunction with shape marks (arrows, custom shapes, etc.) to give instructions via tooltips, and fire filter actions to control navigation to dashboards and worksheets in various ways. This method is described in Tableau's Knowledgebase article, Creating a Table of Contents to Navigate to Other Dashboards. But this in not quite what I wanted. Then Matt Francis posted his very cool article titled Create a default TableauTemplate - now with added 8.1 goodness. Matt got me thinking about the possibility of adding a generic data source to the template that could serve as a framwork for doing TOCs, navigational controls, help buttons, and other things.