Tableau is one of the leading tools used to solve business intelligence (BI) and analytics challenges. With this book, you will master Tableau's features and offerings in various paradigms of the business intelligence domain. It's an update to the successful Mastering Tableau series, which covers essential Tableau concepts, data preparation, and calculations with Tableau. But this book will also include examples on improving dashboard performance, the know-how of data visualizations, and connecting to Tableau Server. This book covers the latest and most exciting features, such as Tableau Prep, the connections with Python and MATLAB, Tableau Extensions, Joins, and Unions, and last but not least, three use cases of powerful Self-Service Analytics, Time Series Analytics, and Geo-Spatial Analytics in order to manifest the learned content. By the End of this book, you'll have mastered the advanced offerings of Tableau and its latest updates, up to Tableau version 2019.1.
Those who are fairly new to Tableau should find this chapter helpful in getting up to speed quickly; however, since this book targets advanced topics, relatively little time is spent considering the basics. For a more thorough consideration of fundamental topics, consider Learning Tableau Edition 3.0, written by Joshua Milligan and published by Packt Publishing.
In this chapter, we'll discuss the following topics:
- Creating worksheets and dashboards
- Connecting Tableau to your data
- Connecting to Tableau Server
- Connecting to saved data sources
- Measure Names and Measure Values
- Three essential Tableau concepts
- Exporting data to other devices
At the heart of Tableau are worksheets and Dashboards. Worksheets contain individual visualizations and Dashboards contain one or more worksheets. Additionally, worksheets and Dashboards may be combined into stories to communicate particular insights to the end user through a presentation environment. Lastly, all worksheets, Dashboards, and stories are organized in workbooks that can be accessed with the Tableau desktop, Server, reader or the Tableau mobile app. In this section, we'll survey creating worksheets and Dashboards, with the intention of communicating the basics, but we'll also provide some insight that may prove helpful to more seasoned Tableau users.
At the most fundamental level, a visualization in Tableau is created by placing one or more fields on one or more shelves. As an example, note that the visualization created in the following diagram is generated by placing the Sales
 field on the Text
shelf:

Let's explore the basics of creating a visualization using an exercise:
- In the workbook, find the tab labeled
Fundamentals of Visualizations
:

Â
- Locate
Department
within theDimensions
portion of theData
pane:

- Drag
Department
to theColor
shelf:

- Click on the
Color
shelf and then onEdit Colors
to adjust the colors as desired:


- Drop other fields on various shelves to continue exploring Tableau's behavior.
As you explore Tableau's behavior by dragging and dropping different fields onto different shelves, you'll notice that Tableau responds with default behaviors. These defaults, however, can be overridden, which we'll explore next.
In the preceding exercise, Fundamentals of visualizations, we can notice that the Mar
ks
card reads Automatic
. This means that Tableau is providing the default view. The default view can be easily overridden by choosing a different selection from the drop-down menu:

Another type of default behavior can be observed when dragging a field onto a shelf. For example, dragging and dropping a measure onto a shelf will typically result in the SUM ()
 aggregation.
Note
In Windows, you can override this default behavior by right-clicking and dragging a field from the Data
 pane and dropping it onto a shelf. Tableau will respond with a dialog box with possible options.
Here's a screenshot of the popup that will appear:

Let's walk through an exercise where we'll override the two default behaviors shown in the preceding screenshot:
- In the workbook associated with this chapter, navigate to the
Overriding Defaults
worksheet. - Right-click and drag
Date of Hire
to theColumns
shelf.
Â
- In the resulting dialog box, choose the second instance of
MONTHÂ (Date of Hire)
:

- Place
Number of Records
on theRows
shelf andDepartment
on theDetail
shelf.
Â
- Click on the
dropdown
in theMarks
card and selectArea
:

Show Me
allows the Tableau author to create visualizations at the click of a button. To understand how it works, let's refer to the following screenshot:
Â

Now let's look at the following aspects that are highlighted in the preceding screenshot:
- A:Â Selected fields in the
Data
pane. - B:Â Fields deployed in the view, that is, pills.
- C:Â The recommended view.
- D:Â Help text that communicates the requirements for creating the recommended view or any selection choice over which the cursor is placed.
Every icon in Show Me
that isn't greyed out represents a visualization that can be created simply by clicking on it. For example, in the diagram preceding, the Tableau author may choose to click on the pie chart icon to create a pie chart based on the selected and deployed fields.
Note
Show Me
options are highlighted based on two criteria: the selected fields in the Data
pane and the fields deployed in the view.
Show Me
may be effectively used for the following reasons:
- Efficiency:Â The proficient Tableau author already knows how to create the basic visualization types.
Show Me
automates these basic types and thus may be used for quicker production. - Inspiration:Â Determining an effective way to visualize a dataset can be challenging.
Show Me
can help with this challenge by allowing the Tableau author to quickly consider various options. - Education:Â An inexperienced Tableau author may access
Show Me
to better understand how various visualizations are created. By reading the help text displayed at the bottom ofShow Me
and observing the results generated by clicking on various options, much can be learned.
These three reasons demonstrate the strong capabilities that Show Me
 provides for worksheet creation, however, be careful not to use it as a crutch. If you click on the various options without understanding how each visualization is created, you're not only shortchanging the educational process, but you may generate results that aren't well-understood, and could thus lead to detrimental business decisions.
Although, as stated in the Creating worksheets and dashboards section, a Dashboard contains one or more worksheets, and Dashboards are much more than static presentations. They're an essential part of Tableau's interactivity. In this section, we'll populate a Dashboard with worksheets and then deploy actions for interactivity.
The following are the steps for building a Dashboard:
In the
Chapter 1
workbook, navigate to theÂBuilding a Dashboard
 tab.
Â
- In the
Dashboard
pane, located on the left side of the screen, double-click on each of the following worksheets (in the order in which they are listed) to add them to the Dashboard pane:ÂAge/State
,Pay Rate
,Tree Map
,Date of Hire
, andÂDate of Termination
:

Â
In the bottom-right corner of the
Dashboard
pane, click in the blank area to select a container. After clicking in the blank area, you should see a blue border around the filter and the legends. This indicates that the vertical container is selected:

Â
Select the vertical container handle and drag it to the left side of the
Customers
worksheet. Note the grey shading, which communicates where the container will be placed:

Note
The grey shading provided by Tableau when dragging elements, such as worksheets and containers, onto a Dashboard, helpfully communicates where the element will be placed. Take your time and observe carefully when placing an element on a Dashboard or the results may be unexpected.
- Format the dashboard as desired. The following tips may prove helpful:
- Adjust the sizes of the elements on the screen by hovering over the edges between each element and then clicking and dragging as desired.
- Note that the
Age legend
andDepartment
filter in the following screenshot are floating elements. Make an element floating by right-clicking on the element handle and selecting Floating (see the previous screenshot and note that the handle is located immediately above the wordRegion
in the top-right corner). - Create horizontal and vertical containers by dragging those objects from the bottom portion of the
Dashboard
pane. - Drag the edges of containers to adjust the size of each worksheet.
- Display the
Dashboard
title through theÂDashboard
, right-click Show Title
:

One of the primary benefits of Tableau is the interactivity it provides the end user. Dashboards aren't simply for viewing; they're meant for interaction. In this exercise, we'll add interactivity to the Dashboard that was created in the previous exercise:
- Starting where the previous exercise ended, click the drop-down menu associated with the
Department
filter and selectApply to Worksheets
, and thenÂ
All Using This Data Source
:

- To use the map as a filter for the other worksheets on the
Dashboard
pane, click theUse as Filter
icon located at the top-right corner of theAge/State
worksheet:

- Set Pay Rate to
Use as Filter
. - Navigate toÂ
Dashboard
 > Actions
.
Â
- In the dialog box, click
Add Action
 > Filter
and create a filter, as shown:

Having completed the preceding dashboard exercise, you should now be able to click on various objects on the dashboard to observe the interactivity. To learn advanced dashboard techniques, be sure to check out Chapter 11, Visualization Best Practices and Dashboard Design.
At the time of writing, Tableau's data connection menu includes 70 different connection types. And that's somewhat of an understatement since some of those types contain multiple options. For example, the selection choice, Other Files, includes 34 options. Of course, we won't cover the details for every connection type, but we will cover the basics.
Upon opening a new instance of Tableau Desktop, you'll notice a link in the top-left corner of the workspace. Clicking on that link will enable you to connect to the data. Alternatively, you can click on the New Data Source icon on the toolbar:

Although in future chapters we'll connect to other data sources, here we'll limit the discussion to connecting to the Microsoft Excel and text files.
Let's compare the instance of the Superstore data source with a new connection to the same data:
- In a new instance of Tableau, navigate toÂ
Data
|ÂNew Data SourceÂ
|Â
Excel
 to connect to the sampleâSuperstore
dataset that installs with Tableau desktop (it should be located on your hard drive underÂMy Tableau Repository
|ÂDatasources
). - Double-click on the
Orders
sheet. - Click on the
Sheet 1
tab. - Place
Discount
on theÂText
 shelf. - Double-click onÂ
Profit
 andÂSales
. - Compare the results of the new worksheet to that of the worksheet entitled
Observing Metadata Differences
in theChapter 1
workbook:- A: The data source name has been altered in the
Chapter 1
workbook. - B: In the
Chapter 1
workbook, the default aggregation ofDiscount
isÂAVG
. In the unaltered instance, the default isÂSUM
. - C:
Product Hierarchy
exists only in theChapter 1
workbook. - D: The format of
Discount
,Profit
, andSales
differs between the two instances. - E:
Profit Ratio
exists only in theChapter 1
workbook:
- A: The data source name has been altered in the

Connecting to Tableau Server is perhaps the single most important server-connection type to consider, since it's frequently used to provide better performance than may otherwise be possible. Additionally, connecting to Tableau Server enables the author to receive not only data, but information regarding how that data is to be interpreted; for example, whether a given field should be considered a measure or a dimension.
The following are the steps for connecting to Tableau Server:
- To complete this exercise, access to an instance of Tableau Server is necessary. If you don't have access to Tableau Server, consider installing a trial version on your local computer.
- In the workbook associated with this chapter, navigate to the Connecting to Tableau Server worksheet.
- Right-click on the Superstore data source and select
Publish to Server
. - Log in to Tableau Server and follow the prompts to complete the publication of the data source.
- Open a new instance of Tableau Desktop and select
Data
 | New Data Source
 |Â
Tableau Server
to connect to the data source published in the previous step. - Click on
Sheet 1
in the new workbook and observe that the changes made in theChapter 1
workbook have been preserved. - In the
Data
pane, right-click onProfit Ratio
and note that it isn't directly editable.
Having completed the preceding two exercises, let's discuss the most germane point, that is, metadata. Metadata is often defined as data about the data. In the preceding case, the data source name, default aggregation, default number formatting, and hierarchy are all examples of Tableau remembering changes made to the metadata. This is important because publishing a data connection allows for consistency across multiple Tableau authors. For example, if your company has a policy regarding the use of decimal points when displaying currency, that policy will be easily adhered to if all Tableau authors start building workbooks by pointing to data sources where all formatting has been predefined.
Â
In step 7 of this exercise, the fact that the Profit Ratio
calculated field wasn't directly editable when accessed by connecting to Tableau Server as a data source has important implications. Imagine the problems that would ensue if different Tableau authors defined Profit Ratio
differently. End users would have no way of understanding what Profit Ratio
really means. However, by creating a workbook based on a published data source, the issue is alleviated. One version of Profit Ratio
is defined and it can only be altered by changing the data source. This functionality can greatly assist consistency across the enterprise.
Connecting to a saved data source on a local machine is very similar to connecting to a data source published on Tableau Server. Metadata definitions associated with the local data source are preserved just as they are on Tableau Server. Of course, since the data source is local instead of remote, the publication process is different.Â
Let's explore the following steps for creating a local data connection using an example:
- In the workbook associated with this chapter, navigate to the
Local Data Connection
tab. - In the
Data
pane, right-click on theSuperstore
data source and selectAdd to Saved Data Sources
. - Using the resulting dialog box, save the data source as
Superstore
inMy Tableau Repository
 | Datasources
, which is located on your hard drive. - Click on the Go to Start icon located in the top-left part of your screen and observe the newly-saved data source:

Note
You can save a local data source that points to a published data source on Tableau Server. First, connect to a published data source on Tableau Server. Then right-click on the data source in your workspace and choose Add to Saved Data Sources
. Now you can connect to Tableau Server directly from your Start page!
I've observed the following scenario frequently, wherein a new Tableau author creates a worksheet and drags a measure to the Text
shelf. The author does this in order to create another row to display a second measure but doesn't know how. They drag the second measure to various places on the view and gets results that seem entirely unpredictable. The experience is very frustrating for the author since it's so easy to accomplish this in Microsoft Excel! The good news is that it's also easy to accomplish this in Tableau. It just requires a different approach. Let's explore the solution with an exercise.
Â
Measure Names
and Measure Values
are generated fields in Tableau. They don't exist in the underlying data, but they're indispensable for creating many kinds of views. As may be guessed from its placement in the Data
pane and its name, Measure Names
is a dimension whose members are made up of the names of each measure in the underlying dataset. Measure Values
contains the numbers or values of each measure in the dataset. Watch what happens when measure names and measure values are used independently. Then observe how they work elegantly together to create a view.
The following are the steps for the exercise:

- Clear the worksheet by clicking on the
Clear Sheet
icon on the toolbar:

- Drag
Measure Names
to theRows
shelf and observe that the view merely displaysNo Measure Value
. - Drag
Measure Values
to theText
shelf. Note the list of measures and associated values.
Perhaps the interrelationship between Measure Names
and Measure Values
is best explained by an analogy. Consider several pairs of socks and a partitioned sock drawer. Step 2 is the equivalent of throwing the socks into a pile. The results are well, disorganized. Step 4 is the equivalent of an empty sock drawer with partitions. The partitions are all in place but where are the socks? Step 5 is a partitioned drawer full of nicely-organized socks. Measure Names
is like the partitioned sock drawer. Measure Values
is like the socks. Independent of one another, they aren't of much use. Used together, they can be applied in many different ways.
Tableau provides various shortcuts to quickly create a desired visualization. If you're new to the software, this shortcut behavior may not seem intuitive. But with a little practice and a few pointers, you'll quickly gain an understanding of it. Let's use the following exercise to explore how you can use a shortcut to rapidly deploy Measure Name
s and Measure Values
:
- In the workbook associated with this chapter, navigate to theÂ
MeasureNames
/Values ShrtCts
 worksheet.
Â
- Drag
Age
directly on top of thePay Rate
number in the view (Show Me
appears):

- Observe the results, including the appearance of the
Measure Values
shelf, and the deployment ofMeasure Names
on theRows
andFilters
shelves andMeasure Values
on theText
shelf:

Â
Several things happened in step 2 of the Measure Names and Measure Values shortcuts exercise. After placing Age on top of the Pay Rate number in the view, Tableau did the following:
- Deployed
Measure Names
on theFilters
shelf.- Open the Measure Names filter and observe that only
Age
andPay Rate
are selected. This limits the view to display only those two measures.
- Open the Measure Names filter and observe that only
- Deployed
Measure Names
on theRows
shelf.
- Displayed theÂ
Measure Values
 shelf.- The
Measure Values
shelf is somewhat redundant. Although it clearly shows the measures that display in the view, it essentially acts as an easy way to access the filter. You can simply drag measures on and off of theMeasure Values
shelf to adjust the filter and thus display/hide additionalMeasure Values
. You can also change the order within theMeasure Values
shelf to change the order of the measures in the view.
- The
- Deployed
Measure Values
on theText
shelf.Measure Values
is simply defining the numbers that will display for each row; in this case, the numbers associated withAge
andPay Rate
.
If the visualization has an axis, the shortcut to deploy Measure Names
and Measure Values
requires the placement of a second measure on top of the axis of an initial measure, as follows:

Â
The road to mastering Tableau begins with three essential concepts. We'll discuss each of the following concepts:
- Dimensions and Measures
- Row Level, Aggregate Level, Table Level
- Continuous and Discrete
Tableau categorizes every field from an underlying data source as either a dimension or a measure. A dimension is qualitative or, to use another word, categorical. A measure is quantitative or aggregable. A measure is usually a number but may be an aggregated, non-numeric field, such as MAX (Date of Hire)
. A dimension is usually a text, Boolean, or date field, but may also be a number, such as Pay Rate
. Dimensions provide meaning to numbers by slicing those numbers into separate parts/categories. Measures without dimensions are mostly meaningless.
Let's look at an example to better understand:
Â
- Place
Date of Hire
andDepartment
on theColumns
shelf:

The result of step 2 is mostly meaningless. The Number of Records
measure is about 302, but without the context supplied by slicing the measure with one or more dimensions, there is really no way to understand what it means. Step 2 brings meaning. Placing Date of Hire
and Department
on the Columns
shelf provides context, which imparts meaning to the visualization.
There are three levels of calculations in Tableau: Row, Aggregate, and Table. To understand how these three levels function, it's important to know the Tableau process flow.
Â
We can see the process flow in the following diagram:

Let's follow the flow to understand where the three levels of calculations take place. We'll do so with an example that considers the Number of Records
and Quantity
fields. Assuming we're using SQL, consider the following calculation types, calculated fields, and queries. Note that the SQL is slightly simplified for the sake of this example.
Let's take a deeper look at the three levels of calculations and consider the example in the following table:
Calculation type | Calculated field in Tableau | Query passed to data source |
Aggregate level |
|
|
Table level |
|
|
Â
For the Row- and Aggregate-level calculations, the computation is actually completed by the data source engine. Tableau merely displays the results. This, however, isn't the case for the Table-level calculation. Although the query passed to the data source for the Table-level calculation is identical to the query for the Aggregate-level calculation, Tableau performs additional computations on the returned results. Let's explore this further with an exercise using the same calculated fields.
Â
Let us look at the following steps and begin our exercise:
- In the workbook associated with this chapter, navigate to theÂ
Row_Agg_Tb
l worksheet. - Select
Analysis
 >ÂCreate Calculated Field
to create the following calculated fields. Note that each must be created separately, that is, it isn't possible in this context to create a single calculated field that contains all three calculations:
Name | Calculation |
Lev â Row |
|
Lev â Agg |
|
Lev â Tab |
|
Â
- In the
Data
pane, right-click on the three calculated fields you just created and selectDefault Properties
 |ÂNumber format
. - In the resulting dialog box, select
Percentage
and clickOK
. - Place
Order Date
on theColumns
shelf. - Place
Measure Names
on theRows
shelf, andMeasure Values
on theText
shelf. - Exclude all values except for
Lev - Row
,Lev - Agg
, andLev - Tab
:

Â
Lev - Agg
is an aggregate-level calculation. The computation is completed by the data source engine. The sum of [Number of Records]
is divided by the sum of [Quantity]
. The results of the calculation are likely useful for the Tableau author.
Lev - Row
is a row-level calculation. The computation is completed by the data source engine. [Number of Records]
is divided by [Quantity]
for each row of the underlying data. The results are then summed across all rows. Of course, in this case, the row-level calculation doesn't provide useful results; however, since a new Tableau author may mistakenly create a row-level calculation when an aggregate-level calculation is what's really needed, the example is included here.
Lev - Tab
is a table calculation. Some of the computation is completed by the data source engine, that is, the aggregation. Tableau completes additional computation on the results returned from the data source engine. Specifically, the results of Lev - Agg
are summed and then divided by the number of members in the dimension. For the preceding example, this is (26.29% + 26.34% + 26.30% + 26.55%)/4. Once again, the results in this case aren't particularly helpful but do demonstrate knowledge the budding Tableau author should possess.
Continuous and discrete aren't concepts that are unique to Tableau. Indeed, both can be observed in many arenas. Consider the following example:

The preceding diagram is of two rivers: River-Left and River-Right. Water is flowing in River-Left. River-Right is composed of ice cubes. Could you theoretically sort the ice cubes in River-Right? Yes! Is there any way to sort the water in River-Left? In other words, could you take buckets of water from the bottom of the river, cart those buckets upstream and pour the water back into River-Left and thereby say, I have sorted the water in the river? No. The H2O in River-Left is in a continuous form, that is, water. The H2O in River-Right is in a discrete form, that is, ice.
Â
Â
Having considered continuous and discrete examples in nature, let's turn our attention back to Tableau. Continuous and discrete in Tableau can be more clearly understood with the following seven considerations:
- Continuous is green. Discrete is blue:
- Select any field in the
Data
pane or place any field on a shelf and you'll note that it's either green or blue. Also, the icons associated with fields are either green or blue.
- Select any field in the
- Continuous is always numeric. Discrete may be a string.
- Continuous and discrete aren't synonymous with dimension and measure:
- It's common for new Tableau authors to conflate continuous with measure and discrete with dimension. They aren't synonymous. A measure may be either discrete or continuous. Also, a dimension, if it's a number, may be discrete or continuous. To prove this point, right-click on any numeric or date field in Tableau and note that you can convert it:

- Discrete values can be sorted. Continuous values can't:
- Sortable/Not sortable behavior is most easily observed with dates, as shown in the following example:

- Continuous colors are gradients. Discrete colors are distinct.
- The following example shows
Profit as continuous
and then as discrete. Note the difference in how colors are rendered. The left portion of the screenshot demonstrates that continuous results in gradients, and the right portion demonstrates that discrete results in distinct colors:
- The following example shows

Â
- Continuous pills can be placed to the right of discrete pills, but not to the left.
- The Tableau author is able to place
Region
to the right ofYear
whenYear
is discrete. - The Tableau author is unable to place
Region
to the right ofYear
whenYear
is continuous:
- The Tableau author is able to place

- Continuous creates axes. Discrete creates headers:
- Note in the left portion of the following screenshot that
Year(Order Date)
is continuous and theYear of Order Date
axis is selected. SinceYear of Order Date
is an axis, the entire x-plane is selected. In the right portion of the following screenshot,Year(Order Date)
is discrete and 2012 is selected. Since 2012 is a header only, it's selected and not the entire x-plane:
- Note in the left portion of the following screenshot that

Â
Once a Dashboard looks as it's expected to, the developer has different choices of sharing the work. An upload to the Tableau Server is the most likely option. The end user might not look at the results on just a laptop; they could use a tablet or cellphone, too.Â
While developing a Dashboard, the Tableau Creator has the option to take a look at Device Designer
or Device Preview
. You can find it here:Â

Please be aware that you can only use the sheets that are in the default layout of your Dashboard. Once you're in the Device Designer
mode, select a Device type
and you'll get choices of the most common Models:

Â
Â
Â
Â
Â
Â
A cellphone is usually designed in portrait orientation. Now move the content in a way that the sheets you want to see on your phone are within the device frame. Satisfied? Then add this layout (top-right corner) to the workbook. It will appear under the Default
one on the top-left side:

The user can now select the design needed, whenever opening a Workbook from the Tableau Server.
A Tablet Dashboard works exactly the same as the cellphone one. Follow the preceding steps to create it, except you have to choose the Tablet Device Type of course and a Tablet's Dashboard is usually in Landscape orientation.Â
Â
In this chapter, we covered the basics of Tableau. We began with some basic terminology, then we looked at the basics of creating worksheets and Dashboards. We focused on default behavior, how to override that behavior, and we considered best practices. Then we reviewed Measure Names and Measure Values.Â
After that, we explored three essential Tableau concepts: Dimensions and Measures, Row-, Aggregate-, and Table-level, and Continuous and Discrete. Of particular importance is understanding that row- and aggregate-level calculations are computed by the data source engine, while table-level calculations are handled by Tableau. Finally, we saw how to adjust your Dashboard for other devices, such as a cellphone or tablet.
In the next chapter, we'll continue our Tableau exploration by looking at data. We'll explore how to prepare data for Tableau by looking at joins, blends, and data structures, such as data densification, cubes, and big data.