Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Moving from Foundational to Advanced Visualizations

Save for later
  • 38 min read
  • 16 Apr 2015

article-image

This article is written by Joshua N. Milligan, the author of Learning Tableau. You are now ready to set out on a journey of building advanced visualizations! "Advanced" does not necessarily mean difficult. Tableau makes many of these visualizations easy to create. Advanced also does not necessarily mean complex. The goal is to communicate the data, not obscure it in needless complexity.

(For more resources related to this topic, see here.)

Instead, these visualizations are advanced in the sense that you will need to understand when they should be used, why they are useful, and how to leverage the capabilities of Tableau to create them. Additionally, many of the examples introduce some advanced techniques, such as calculations, to extend the usefulness of foundational visualizations.

Most of the examples in this article are designed so that you can follow along. However, don't simply memorize a set of instructions. Instead, take time to understand how the combinations of different field types you place on different shelves change the way headers, axes, and marks are rendered. Experiment and even deviate from the instructions from time to time just to see what else is possible. You can always use Tableau's back button to return to following the example!

Visualizations in this article will fall under these major categories:

  • Comparison
  • Dates and times
  • Parts of the whole
  • Distributions
  • Multiple axes

You may notice the lack of a spatial location or geographic category in the preceding list.

Comparing values across different dimensions

Often, you will want to compare the differences of measured values across different dimensions. You might find yourself asking questions like these:

  • How much profit did I generate in each department?
  • How many views did each of my websites get?
  • How many cases did each doctor in the hospital treat last year?

In each case, you are looking to make a comparison (among departments, websites, or doctors) in terms of some quantitative measurement (profit, number of views, and the count of cases).

Bar charts

Here is a simple bar chart created using the Superstore Sales data source:

moving-foundational-advanced-visualizations-img-0

The sum of sales is easily compared for each category of item sold in the chain of stores. Category is used as a discrete dimension in the view, which defines row headers (because it is discrete) and slices the sum of sales for each category (because it is a dimension). Sales defines an axis (because it is continuous) and is summed for each category (because it is a measure).

Note that the bar chart is sorted with the category that has the highest sum of sales at the top and the lowest at the bottom. Sorting a bar chart adds a lot of value to the analysis because it makes it easy to determine rank. For example, it is easy to see that Bookcases has more total sales than Computer Peripherals even though the bar lengths are close. Were the chart not sorted, it may not have been as obvious.

You can sort a view in multiple ways:

  • Click on one of the sort icons on the toolbar. This results in automatic sorting of the dimension based on the measure that defined the axis. Changes in data or filtering that result in a new order will be reflected in the view.

    moving-foundational-advanced-visualizations-img-1

  • Click on the sort icon on the axis. This will also result in automatic sorting.

    moving-foundational-advanced-visualizations-img-2

  • Use the dropdown on the active dimension field and select Sort.... You can also select Clear Sort to remove any sorting.

    moving-foundational-advanced-visualizations-img-3

  • Drag and drop row headers to manually rearrange them. This results in manual sorting that does not get updated.

Any of these sorting methods are specific to the view and will override any default sort you defined in the metadata.

Bar chart variations

A basic bar chart can be extended in many ways to accomplish various objectives. Consider the following variations:

  • Showing progress toward a goal
  • Highlighting a single category

Bullet charts – showing progress toward a goal

Let's say you are a global manager and you've set the following profit targets for your regional managers:

Region

Profit target

Central

600,000

East

350,000

South

100,000

West

300,000

You maintain these goals in a spreadsheet and might like to see a visualization that shows you how actual profit compares with your goals. Continue with the connection to the Superstore Sales data and follow these steps to see a couple of options:

  1. You will find a Profit Targets connection containing this data. The data is also located in a text file in the ResourcesData directory.
  2. Using the Superstore Sales connection, create a basic bar chart showing the sum of profit per region.

    moving-foundational-advanced-visualizations-img-4

  3. Select the Profit Targets connection and click to highlight the Profit Target field in the Data window.

    Open Show Me and select the bullet graph. At this point, Tableau has created a bullet graph using the fields in the view and the Profit Target field you had selected. You'll observe that the Reference field has been used in the data blend to link the two data sources and it is already enabled because the Region field was used in the view.

    moving-foundational-advanced-visualizations-img-5

  4. Unfortunately, Show Me placed Profit Target on Columns and placed Profit in the Level of Detail field and used it for reference lines. The bars show the target and the reference line shows the actual value. This is the reverse of what you want. To correct it, right-click on the Profit Target axis and select Swap Reference Line fields. You now have a bullet chart showing the actual profit compared to the target.

    moving-foundational-advanced-visualizations-img-6

  5. Rename this worksheet Bullet Chart.

    Now, you can clearly see that your Central region manager is falling short of the goal you set. Bullet graphs make use of reference lines. For now, right-click on the axis and select Edit Reference Line, Band or Box to explore this feature.

The bar-in-bar chart

Another way to show the progress toward a goal is to use bar-in-bar charts, such as this:

moving-foundational-advanced-visualizations-img-7

To create this view, continue in the same workbook and follow these steps:

  1. Duplicate the Bullet Chart sheet you created (right-click on the sheet tab and select Duplicate Sheet).
  2. Drag the Profit Target field from the Marks card and drop it directly onto the axis. As you are dropping one measure (Profit Target) onto the same space (in this case, an axis) that was being used by another measure (Profit), Tableau substituted the special fields' Measure Names and Measure Values.

    Any time you want two or more measures to share the same space within a view, you can use Measure Names and Measure Values.

    Measure Names is a special dimension field that Tableau adds to every data source; it is a placeholder for the names of measures. You can place it in the view anywhere you would place another dimension.

    Measure Values is a special measure field that Tableau adds to every data source; it is a placeholder for the values of other measures. You can use it in any way you would use any other measure.

    When these special fields are in use, you will see a new Measure Values shelf in the workspace. This shelf contains all the measures that are referenced by Measure Names and Measure Values. You can add and remove measures to and from this shelf as well as rearrange the order of any measures on the shelf.

    You can drag and drop the Measure Names and Measure Values fields directly from the Data window into the view. Many times, it is easy to remember that if you want two or more measures to share the same space, simply drag and drop the second onto the same space that is occupied by the first. For example, if you want multiple measures to define a single axis, drag and drop the second measure to the axis. If you want two or more measures to occupy the pane, drop the second onto the pane.

  3. Move the Measure Names field to the Color shelf and edit the colors in the legend (double-click on the legend or use the drop-down arrow on the legend) and set Profit to Orange and Profit Target to Gray). You now have a stacked bar chart with a different color for each measure name being used.

    moving-foundational-advanced-visualizations-img-8

  4. Copy the Measure Names field from Color to the Size shelf (hold Ctrl while you drag a field in the view and drop it on another shelf in the view). This creates different sizes for each bar segment.
  5. Tableau's default is to stack bar marks. In this case, you do not want the bars to be stacked. Instead, you want them to overlap. To change the default behavior, from the menu, navigate to Analysis | Stack Marks | Off.
  6. Rename the worksheet to Bar-in-Bar.

Highlighting a single category

Let's say one of your primary responsibilities at the superstore is to monitor the sales of tables. You don't necessarily care about the details of other categories, but you do want to keep track of how tables compare with other categories. You might design something like this:

moving-foundational-advanced-visualizations-img-9

Now, you will be able to immediately see where tables are compared to other categories as sales figures change day to day. To create this view, follow these steps:

  1. Place Category on Columns and SUM(Sales) on Rows. Sort the bar chart in descending order.
  2. Create a calculated field from the menu by navigating to Analysis | Create Calculated Field…. For now, name the calculation Category is Table? and enter the [Category] = "Tables" code. This calculation tests the equality and returns true if the value of the Category field is "Tables" and false otherwise.

    moving-foundational-advanced-visualizations-img-10

  3. When you click on OK in the Calculated Field dialog, a new field named Category is Table? will appear as a new dimension. Drag and drop this field onto the Color shelf.
  4. Edit the color palette by either double-clicking on the color legend or locating the drop-down caret in the upper-right section of the legend and selecting Edit from the drop-down menu. Make the False value a light gray.

    moving-foundational-advanced-visualizations-img-11

    You can fine-tune any color and select colors that are not included in a standard palette by double-clicking on the desired value under Select Data Item in the Edit Colors dialog.

  5. Hide the column headers for the Category field using the drop-down active field menu and unchecking Show Headers. As all you care about is how tables relate to other categories and don't specifically care what the other categories are, this will clean up the chart and allow you to focus on what's important.
  6. You can add an annotation by right-clicking on the bar and selecting Annotate | Mark....

    Annotations can be used to display values of data and freeform text to draw attention or give explanation. There are three kinds of annotations in Tableau: Mark, Point, and Area.

    Mark annotations are associated with a specific mark (such as a bar or a shape) in the view. The annotation can display any data associated with the mark. It will be shown in the view as long as that mark is visible.

    Point annotations are associated with a specific point, as defined by one or more axes in the view. The annotation can display values that define the X and/or Y location of the point. This will be shown in the view as long as the point is visible.

    Area annotations are associated with an area in the view. They are typically shown when at least part of the defined area is visible.

  7. Rename the current sheet Highlight Single Value.

Visualizing dates and times

Often in your analysis, you will want to understand when something happened. You'll ask questions like these:

  • When did we gain the most new customers?
  • What time of the day has the highest call volume?
  • What kinds of seasonal trends do we see in sales and profit?

Fortunately, Tableau makes this kind of visual discovery and analysis easy.

The built-in date hierarchy

When you are connected to a flat file, relational, or extracted data source, Tableau provides a robust built-in date hierarchy for any date field.

Cubes/OLAP connections do not allow Tableau hierarchies. You will want to ensure that all date hierarchies and date values you need are defined in the cube.

To see this in action, continue with the visualization workbook and create a view similar to the one shown in the following screenshot by dragging and dropping Sales to Rows and Order Date to Columns:

moving-foundational-advanced-visualizations-img-12

Note that even though the Order Date field is a date, Tableau defaulted to showing sales by year. Additionally, the field on Columns has a + icon, indicating that the field is part of a hierarchy that can be expanded. When you click on the + icon, additional levels of the hierarchy are added to the view. Starting with Year, this includes Year, Quarter, Month, and Day. When the field is a date and time, you can further drill down into Hour, Minute, and Second. Any of the parts of the hierarchy can be moved within the view or removed from the view completely.

You may specify how a date field should be used in the view by right-clicking on the date field or using the drop-down menu and selecting various date options.

As a shortcut, you can right-click and drag drop a date field into the view to get a menu of options for how the date field should be used prior to the view being drawn.

The options for a date field look like this:

moving-foundational-advanced-visualizations-img-13

The three major ways a date field can be used are:

  • Date Part: The field will represent a specific part of the date, such as Quarter or Month. The part of the date is used by itself and without reference to any other part of the date. This means that a date of November 8, 1980, when used as a month date part, is simply November:

    moving-foundational-advanced-visualizations-img-14

    In this view, the bar for November represents the sum of sales for all November months regardless of the year or day.

  • Date Value: The field will represent a date value but rolled up or truncated to the level you select. For example, if you select a date value of Month, then November 8, 1980 gets truncated to the month and year and becomes November 1980.

    moving-foundational-advanced-visualizations-img-15

    This view, for example, includes a bar for the sum of sales for November 2012 and another bar for November 2013. All individual dates within the month have been rolled up, so sales for November 1, 2013 and November 11, 2013 are all summed under November 2013.

  • Exact Date: The field represents the exact date value (including the time, if applicable) in the data. This means that November 8, 1980 2:01 a.m. is treated as distinct from November 8, 1980 3:08 p.m.

    It is important to note that nearly any of these options can be used as discrete or continuous fields. Date parts are discrete by default. Date values and exact dates are continuous by default. However, you can switch them between discrete and continuous as needed to allow flexibility in the visualization.

    For example, you must have an axis (and thus, a continuous field) to create a reference line. Also, Tableau will only connect lines at the lowest level of row or column headers. Using a continuous date value instead of multiple discrete date parts will allow you to connect lines across multiple years, quarters, and months.

Variations in date and time visualizations

The ability to use various parts and values of dates and even mix-and-match them gives you a lot of flexibility to create unique and useful visualizations.

For example, using the month date part for columns and the year date part for color gives a time series that makes the year-over-year analysis quite easy. The year date part has been copied to Label so that the lines could be labeled.

moving-foundational-advanced-visualizations-img-16

Clicking on any of the shelves on the Marks card will give you a menu of options. Here, Label has been clicked and the label was adjusted so that it is displayed only at the start of each line.

Here is another example of using date parts on different shelves to achieve useful analysis. This kind of visualization can be quite useful when looking at patterns across different parts of time, such as hours in a day or weeks in a month.

moving-foundational-advanced-visualizations-img-17

This view shows you the sum of sales for the intersection of each day and each month. Year has not been included in the view, so this is an analysis of all years in the data and allows us to see whether there are any seasonal patterns or "hot spots". Observe that placing a continuous field on the Color shelf resulted in Tableau completely filling each intersection of row and column with the shade of color that encoded the sum of sales. Clicking on the Color shelf gives some fine-tuning options. Here, a white border has been added to help distinguish each cell.

Gantt charts

Gantt charts can be incredibly useful to understand any series of events with duration, especially if these events have some kind of relationship. Visually, they are very useful to determine whether certain events overlap, have dependency, or are longer or shorter than other events. For example, here is a Gantt chart that shows a series of processes, some of which are clearly dependent on others:

moving-foundational-advanced-visualizations-img-18

Gantt charts can be created fairly easily in Tableau. Tableau uses the Gantt mark type that places a Gantt bar starting at the value defined by the field defining the axis. The length of the Gantt bar is set by the field on the Size card.

Let's say you want to visualize the time it takes from an order being placed to the time the order is shipped. You might follow steps similar to these:

  1. Place Order Date on Columns as Exact Date or as a Day value. Note that Tableau defaults the marks to Gantt bars.
  2. Place Order ID on Rows. If you receive a warning that there are many members of the dimension, select Add all Members. The result is a row for each order. The Gantt bar shows you the date of the order.

    When creating Gantt charts, you will want to include dimensions in the view that give you a meaningful level of detail so that you can see each event of interest. If you are not careful, you could aggregate durations improperly or overlap Gantt marks, resulting in a false representation of data.

  3. Filter the view for December 2013. Accomplish this by dragging and dropping the Order Date field on the Filters shelf. Select the Month / Year option and then choose the single month and year from the list.
  4. The length of the Gantt bar is set by placing a field with a value of duration on the Size shelf. There is no such field in this dataset. However, we have the Ship Date option and we can create a calculated field for the duration. For now, select Analysis from the menu and click on Create Calculated Field…. Name the field Time to Ship and enter the following code:

    DATEDIFF('day', [Order Date], [Ship Date])

    When using a date axis, the length of Gantt bars always needs to be in terms of days. If you want to visualize events with durations that are measured in hours or seconds, avoid using the 'day' argument for DATEDIFF because it computes whole days and loses precision in hours and seconds.

    Instead, calculate the difference in hours or seconds and then convert it to days. The following code converts the number of seconds between a start and end date and then divides it by 86,400 to convert the result into days (including fractional parts of the day):

    DATEDIFF('second', [Start Date], [End Date]) / 86400
  5. The new calculated field should appear under Measures in the Data window. Drag and drop the field onto the Size shelf. You now have a Gantt chart showing when orders were placed. There is, however, one problem. Some orders include more than one item and you are showing the sum of days to ship. This means that if one item took 5 days to ship and another item in the same order took 7 days, the length of the bar shows 12 days for the order. If both items took 5 days and were shipped at the exact same time, the length of the bar indicates 10 even though the order really only took 5 days.
  6. To correct this, decide whether you want to show the minimum number of days or the maximum number of days for each order, right-click on the Days to Ship field on the Marks card, or use the drop-down menu and navigate to Measure | Minimum or Measure | Maximum. Alternately, you might decide to add Item to the Detail card of the Marks card.

    Unlock access to the largest independent learning library in Tech for FREE!
    Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
    Renews at €18.99/month. Cancel anytime

    Your final view should look something like this:

    moving-foundational-advanced-visualizations-img-19

    Often, you'll want to sort a Gantt chart so that the earliest start dates appear first. Do this via the drop-down menu of the dimension on Rows and select Sort. Sort it in ascending order by the minimum of the date field.

Relating parts of the data to the whole

As you explore and analyze data, you'll often want to understand how various parts add up to a whole. For example, you'll ask questions like these:

  • How many patients with different admission statuses (in-patient, out-patient, observation, or ER) make up the entire population of patients in the hospital?
  • What is the percentage of total national sales made in each state?
  • How much space does each file, subdirectory, and directory take on my hard disk?

These types of questions ask about the relationship between the part (patient type, state, or file/directory) and the whole (the entire patient population, national sales, and hard disk). There are several types of visualizations and variations that can aid you in your analysis.

Stacked bars

It is difficult to compare values across categories for any but the bottom-most bar (for vertical bars) or the left-most bar (for horizontal bars). The other bar segments have different starting points, so lengths are much more difficult to compare.

In this case, however, we are using stacked bars to visually understand the makeup of the whole. We are less concerned with a visual comparison across categories.

Say a bank manager wants to understand the makeup of her lending portfolios. She might start with a visualization like this:

moving-foundational-advanced-visualizations-img-20

This gives a decent view of the makeup of each portfolio. However, in this case, the bank manager already knows that the bank has more balance in first-mortgage loans than fixed second loans. However, she wants to understand whether the relative makeup of the portfolios is similar; specifically, do the High Risk balances constitute a higher percentage of balances in any portfolio?

Consider this alternative:

moving-foundational-advanced-visualizations-img-21

None of the data has changed, but the bars now represent the percent age of the total of each portfolio. You can no longer compare the absolute values, but comparing the relative breakdown of each portfolio has been made much easier. The bank manager may find it alarming that nearly 25 percent of the balance of HELOC loans is in the high-risk category when the bar segment looked fairly small in the first visualization.

Creating this kind of visualization is relatively easy in Tableau. It involves using quick table calculations, but it only takes a few clicks to implement.

Continuing with the Advanced Visualizations workbook, follow these steps:

  1. Create a stacked bar chart like what is shown in the following screenshot with Department on Rows, Shipping Cost on Columns, and Ship Mode on Color.
  2. Duplicate the Shipping Cost field on Columns either by holding Ctrl while dragging the Shipping Cost field from Columns to Columns, immediately to the right of its current location, or by dragging and dropping it from the Data window to Columns. At this point, you have two Shipping Cost axes that, in effect, duplicate the view.

    moving-foundational-advanced-visualizations-img-22

  3. Using the drop-down menu of the second Shipping Cost field, navigate to Quick Table Calculation | Percent of Total. This table calculation runs a secondary calculation on the values returned from the data source to compute a percent of the total. You will need to further specify how that total should be computed.
  4. Using the same drop-down menu, navigate to Compute Using | Table (Across). This tells Tableau to compute the table calculation across the table, which in this case means that the values will add up to 100 percent for each department.
  5. Turn on labels by clicking on the Abc button on the top toolbar. This turns on default labels for each mark. As you've already seen, you can customize labels by dropping a field on the Label shelf and fine-tune it further by clicking on the shelf.

    moving-foundational-advanced-visualizations-img-23

  6. Right-click on the second axis, which is now labeled % of Total Shipping Cost and select Edit Axis…. Then, set Range as Fixed from 0 to 1. In this case, you know the total will always be 100%, so fixing the axis from 0 to 1 allows Tableau to draw the bars all the way across.

    moving-foundational-advanced-visualizations-img-24

Treemaps

Treemaps use a series of nested rectangles to represent hierarchical relationships of parts to whole. Treemaps are particularly useful when you have hierarchies and dimensions with high cardinality (a high number of distinct values).

Here is an example of a treemap that shows you how the sales of each item add up to give the total sales by category, then department, and finally, the total sales overall. Profit has been encoded by color to add additional analytical value to the visualization. It is now easy to pick out items with negative profit that have relatively high sales when placed in the context of the whole:

moving-foundational-advanced-visualizations-img-25

Treemaps, along with packed bubbles, word clouds, and a few other chart types, are called non-Cartesian chart types. This means that they are drawn without an x or y axis and do not even require row or column headers.

To create a treemap, you simply need to place a measure on the Size shelf and a dimension on the Detail shelf. You can add additional dimensions to the level of detail to increase the detail of the view.

You can quickly change a treemap into a word cloud or a packed bubble chart by changing the mark type from Automatic (which is Square) to Circle (for packed bubbles) or Text (for word clouds).

The order of the dimensions on the Marks card defines the way the treemap groups the rectangles. Additionally, you can add dimensions to rows or columns to slice the treemap into multiple treemaps. Effectively, the end result is a bar chart of treemaps! The following is an example:

moving-foundational-advanced-visualizations-img-26

The treemap in the preceding screenshot not only demonstrates the ability to have multiple rows (or columns) of treemaps, but it also demonstrates the technique of placing multiple fields on the Color shelf. This can only be done with discrete fields. You can assign two or more colors by holding the Shift key while dropping the second field on the color. Alternately, the icon or space to the left of each field on the Marks card can be clicked on to change which shelf is used for the field.

moving-foundational-advanced-visualizations-img-27

Area charts

You might think of an area chart as a line chart in which one line is drawn with the area under it filled. Subsequent areas are stacked on top.

As an example, consider a visualization of delinquent loan balances being analyzed by the bank manager:

moving-foundational-advanced-visualizations-img-28

This area chart shows you the delinquent balance over time. Each band represents a different severity of delinquency. In many ways, the view is aesthetically pleasing, but it suffers from some of the same weaknesses as the stacked bar chart. As all but the bottom band have different starting locations month to month, it is difficult to compare the bands between months. For example, it is obvious that there is a spike in delinquent balances in September. But is it in all bands? Or is one of the lower bands pushing the higher bands up? Which band has the most significant spike?

Now, consider this similar view:

moving-foundational-advanced-visualizations-img-29

This view uses a quick table calculation similar to the stacked bars. It makes it clearer that the percent age of balance within the 31 to 60 days delinquent range increased in September. However, it is no longer clear that September represents a spike in balances. If you were telling a story with this data, you would want to carefully consider what either visualization might represent or misrepresent.

Creating an area chart is fairly simple. Simply create a line chart or time series as you did previously, and then change the mark type on the Marks card to Area. Any dimensions on the Color, Label, or Detail shelves will create slices of area that will be stacked on top of each other. The Size shelf is not applicable to an area chart.

You can define the order in which the areas are stacked by changing the sort order of the dimensions on the shelves of the Marks card. If you have multiple dimensions defining slices of area, you can also rearrange them on the Marks card to further adjust the order.

Pie charts

Pie is actually a mark type in Tableau. This gives you some additional flexibility with pie charts that is not available for other chart types, such as the ability to place them on maps.

Creating a pie chart is not difficult. Simply change the mark type to Pie. This will give you an Angle shelf that you can use to encode a measure. Whatever dimension(s) you place on the Marks card (typically on the Color shelf) will define the slices of the pie. The following is an example of a pie chart in Tableau:

moving-foundational-advanced-visualizations-img-30

You'll notice that the pie chart here uses Sales to define the angle of each slice; the higher the sum of sales, the wider the slice. The Department dimension slices the measure and defining slices of the pie. This view also demonstrates the ability to place multiple fields on the Label shelf. The second SUM(Sales) field is the percent age of the total table calculation you saw previously.

Be careful when using pie charts. Most visualization experts will affirm that it is far more difficult for the human eye to differentiate differences in angles than it is to differentiate differences in length or position. For example, without the labels in the preceding chart, would you really be able to tell whether one slice was really 25 percent instead of 30 percent? A bar chart showing sales for the three departments would be more readable.

Visualizing distributions

Often, simply understanding totals, sums, and even the breakdown of part-to-whole only gives you a piece of the overall picture. Many times, you'll want to understand where individual items fall within a distribution of all similar items.

You might find yourself asking questions like these:

  • How long do most of our patients stay in the hospital? Which patients fall outside the normal range?
  • What's the average life expectancy for components in a machine and which components fall above or below that average? Are there any components with extremely long or extremely short lives?
  • How far above or below "passing" were most students' test scores?

These questions all have similarities. In each case, you are asking for an understanding of how individuals (patients, components, and students) compared with each other. In each case, you most likely have a relatively high number of individuals. In data terms, you have a dimension (Patient, Component, and Student) with high cardinality (a high number of distinct individual values) and some measures (Length of Stay, Life Expectancy, and Test Score) you'd like to compare. Using one or more of the upcoming visualizations might be a good way to do this.

Circle charts

Circle charts are one way to visualize a distribution. Consider the following view, which shows you how each state compares to other states within the same region in terms of total profit:

moving-foundational-advanced-visualizations-img-31

Here, you can easily see that certain states do far better or far worse than others in terms of profit. More than that, you can see whether the state has made or lost money and how much above or below the regional average the state was.

Creating the view is not difficult. After placing the fields on shelves as shown in the preceding screenshot, simply change the mark type from Automatic (Bar) to Circle. Region defines the rows and each circle is drawn at the level of state that is in the level of Detail on the Marks card. Finally, to add the average lines, simply right-click on the Profit axis and select Add a Reference Line, Band, or Box…. In the resulting options window, add a line, Per Cell, for the average of SUM(Profit). You can adjust the label and formatting of the reference line as desired.

Jittering

When using views such as circle plots, you'll often see that marks overlap, which can lead to obscuring of the true story. Do you know for certain, just by looking, that there is only one state in the west region that is unprofitable? Or could there be two circles exactly overlapping? One way to minimize this is to click on the Color shelf and add some transparency and a border to each circle. Another approach is a technique called jittering.

Jittering is a common technique in data visualization that involves adding a bit of intentional noise to a visualization to avoid overlap without harming the integrity of what is communicated. Alan Eldridge and Steve Wexler are among those who pioneered techniques for jittering in Tableau.

Other jittering techniques can be found by searching for jittering on the Tableau forums or Tableau jittering using a search engine.

Here is one approach to add a jitter:

  1. Start by duplicating the view created earlier and create a calculated field named Index with the Index() code. Index is a table calculation that starts with a value of 1 and increments for each intersection of dimension values within a partition of the view.
  2. Place the newly created Index field on Rows to the right of Region.
  3. Using the drop-down menu for Index, navigate to Compute Using | State.
  4. Using the drop-down menu for Index, uncheck Show Header to hide the axis. The values do not carry any meaning that needs to be conveyed to your audience.
  5. The faint horizontal grid lines do not add anything to the visualization. From the menu, navigate to Format | Lines and then set Grid Lines to None. Alternately, you may choose to keep the vertical lines, so instead, set Grid Lines to None under the Rows tab only. The following will be the result:

    moving-foundational-advanced-visualizations-img-32

What you've done is index each state within each region. As Index is continuous (green), it defines an axis and causes the circles to spread out vertically. Now you can more clearly see each individual mark and have higher confidence that overlap is not obscuring the true picture of the data. You can use jittering techniques on many different kinds of visualizations.

Box and whisker plots

Box and whisker plots add additional information and context to distributions. They show the upper and lower quartile and whiskers, which extend to either 1.5 times the upper/lower quartile or to the maximum/minimum values in the data. This allows you to see which data points are close to normal and which are outliers.

The following is the circle chart from the previous example, with the addition of boxes and whiskers:

moving-foundational-advanced-visualizations-img-33

To add box and whisker plots, right-click on an axis and select Add a Reference Line, Band, or Box…. Select Box Plot and set the desired options and formatting.

Histograms

Another possibility to show a distribution is to use a histogram. A histogram looks similar to a bar chart, but the bars show the count of occurrences of a value. For example, standardized test auditors looking for evidence of grade tampering might construct a histogram of student test scores.

Typically, a distribution might look like this:

moving-foundational-advanced-visualizations-img-34

The test scores are shown on the x axis and the height of each bar shows the number of students who had that particular score. A typical distribution should have a fairly recognizable curve with some students doing poorly, some doing extremely well, and most falling somewhere in the middle.

Consider the implications if auditors observed the following visualization:

moving-foundational-advanced-visualizations-img-35

Something is clearly wrong. It appears that graders bumped up students who were just shy of passing to barely passing. Histograms are very useful in catching anomalies like this.

You can create a histogram in Tableau by following steps similar to these:

  1. Create a bin for a numeric field (typically, a measure) by right-clicking on the field in the Data window and selecting Create Bins…. A bin is a grouping of measure values by range. You can define the size of each bin. The bin will be displayed as a new Dimension field in the Data window. For this example, create bins of 100 for the Sales measure.
  2. Based on your data and questions, decide what you want to count. Do you want to count the number of records that occur in each sales bin? Use the Number of Records field. Do you want to count the number of distinct customers that fall into each bin? Right-click plus drag the Customer ID field onto Rows and select CNTD.

Histograms can also be created very easily using Show Me. Simply select a single measure and then select Histogram from Show Me. It will create the bin and place the required fields on the view. You can adjust the size of a bin by right-clicking on it in the Data window.

Here is an example of a histogram of the number of distinct customers for each sales bin. More customers purchased between $0 and $100 than any other range.

moving-foundational-advanced-visualizations-img-36

Just like dates, the bin field drop-down includes an option for Show Missing Values. This can be very useful to avoid distorting the visualization and to identify what values don't occur in the data.

Visualizing multiple axes to compare different measures

Often, you'll need to use more than one axis to compare different measures, understand correlation, or analyze the same measure at different levels of detail. In these cases, you'll use visualizations with more than one axis.

Scatterplots

A scatterplot is an essential visualization type to understand the relationship between two measures. Consider a scatterplot when you find yourself asking questions like these:

  • Does how much I spend on marketing really make a difference to sales?
  • How much does power consumption go up with each degree of heating/cooling?
  • Is there any correlation between rental price and the length of contract?

Each of these questions seeks to understand the correlation (if any) between two measures. Scatterplots are great to see these relationships and also to locate outliers.

Consider the following scatterplot, which looks at the relationship between the measures of the sum of Sales (on the x axis) and the sum of Profit (on the y axis):

moving-foundational-advanced-visualizations-img-37

The dimensions of Department and Category on the Marks card define the level of detail. Color has been used to make it easy to see which department the category belongs to. Each mark in the view represents the total sales and total profit for a particular category in a particular department. The size of each circle indicates the number of distinct items sold in the category/department. The scatterplot points out an issue with tables. They have high sales but are unprofitable. Telephones, on the other hand, have high sales and high profit.

Dual Axis

One very important features of Tableau is Dual Axis. Scatterplots use two axes, and they are x and y. You've already seen how to use Measure Names and Measure Values to show more than one measure on a single axis. You saw in the stacked bar example that placing multiple continuous (green) fields next to each other on Rows or Columns results in multiple side-by-side axes. Dual axis, on the other hand, means that a view is using two axes that are opposite to each other with a common pane.

For example, this view uses a dual axis for Sales and Profit:

moving-foundational-advanced-visualizations-img-38

You can observe several key features of the view:

  • The Sales and Profit fields on Rows indicate that they have a dual axis by sharing a flattened side.
  • The Marks card is now an accordion-like control with an All section and a section for Sales and Profit. You can use this to customize marks for all measures or specifically customize marks for either Sales or Profit.
  • Sales and Profit both define y axes that are on opposite sides of the view.
  • Note that the peaks of the lines might lead you to believe that Sales and Profit were roughly equal in value at certain points. This is unlikely to be the case. Indeed, it is not. Instead, the axes are not in sync. Sales of $1,000,000 align with profit of just over $200,000. To fix this, right-click on the Profit axis and select Synchronize Axis.

    You must set the synchronize option using the secondary axis (Profit in the example). If the Synchronize Axis option is ever disabled on the secondary axis, it is likely that the two fields defining the axes are different numeric types.

    For example, one may be an integer, while the other may be a decimal. To enable the synchronize option, you'll need to force a match of the types by either changing the data type of one of the fields in the metadata or by creating a calculated field that specifically casts one of the fields to the matching type (for example, INT or FLOAT).

Creating a dual axis is relatively easy. Simply drag and drop two continuous (green) fields next to each other on Rows or Columns, and then use the drop-down menu on the second and select Dual Axis. Alternately, you can drop the second field onto the canvas opposite the existing axis.

Dual axes can be used with any field that defines an axis. This includes continuous numeric fields, continuous date fields, and latitude or longitude fields that define a geographic visualization. In the case of latitude or longitude, simply copy the field, place it immediately next to itself on Rows or Columns, and select Dual Axis.

Combination charts

Combination charts extend the use of dual axes to overlay different mark types. This is possible because the Marks card will give options to edit all marks or customize marks for each individual axis.

Multiple mark types are available any time two or more continuous fields are located beside each other on Rows or Columns. This means that you can create views with multiple mark types even when you are not using a dual axis.

Consider the following visualization:

moving-foundational-advanced-visualizations-img-39

This chart uses a combination of bars and lines to show the total sales over time (using bars) and the breakdown of sales by department over time (using lines). This kind of visualization can be quite effective at giving additional context to detail.

There are several things to note about this view:

  • The field on the Color shelf is listed as Multiple Fields and is gray on the Marks card. This indicates that different fields have been used for Color for each axis on the Marks card (no field for the first Sales axis and Department for the second).
  • The view demonstrates the ability to mix levels of detail in the same view. The bars are drawn at the highest level, while the lines are drawn at the level of Department.
  • The view demonstrates the ability to use the same field (Sales, in this case) multiple times on the same shelf (Rows, in this case).
  • The second axis (the Sales field on the right-hand side) has the header hidden to remove redundancy from the view.
  • The months have been formatted to show abbreviations. This was done via the drop-down menu of the Order Date field on Columns, selecting Format, and selecting the desired format of the field for headers.

Dual axis and combination charts open a wide range of possibilities for mixing mark types and levels of detail.

Summary

We covered quite a bit of ground in this article! You should now have a good grasp of when to use certain types of visualizations. The types of questions you ask of the data will often lead you to a certain type of view. You explored how to create these various types and how to extend basic visualizations using a variety of advanced techniques, such as calculated fields, jittering, multiple mark types, and dual axis. Along the way, we also covered some details on how dates work in Tableau using the special Measure Names / Measure Values fields.

Hopefully, the examples using calculations have made you eager to learn more about creating calculated fields. The ability to create calculations in Tableau opens up endless possibilities for extending data, calculating results, customizing visualizations, and creating rich user interactivity.

Resources for Article:


Further resources on this subject: