Reader small image

You're reading from  Learning Tableau 2022 - Fifth Edition

Product typeBook
Published inAug 2022
PublisherPackt
ISBN-139781801072328
Edition5th Edition
Tools
Right arrow
Author (1)
Joshua N. Milligan
Joshua N. Milligan
author image
Joshua N. Milligan

Joshua N. Milligan is a Hall of Fame Tableau Zen Master and 2017 Iron Viz Global finalist. His passion is training, mentoring, and helping people gain insights and make decisions based on their data through data visualization using Tableau and data cleaning and structuring using Tableau Prep. He is a principal consultant at Teknion Data Solutions, where he has served clients in numerous industries since 2004.
Read more about Joshua N. Milligan

Right arrow

Connecting to Data in Tableau

Tableau offers the ability to connect to nearly any data source. It does this with a unique paradigm that leverages the power and efficiency of existing database engines (for example, Snowflake or SQL Server) or alternatively extracts the data locally.

We’ll look at relating tables of data together using joins, blends, unions, and the object model in Chapter 14, Understanding the Tableau Data Model, Joins, and Blends. In this chapter, we’ll focus on essential concepts of how Tableau connects to and works with data more broadly. We’ll cover the following topics:

  • The Tableau paradigm
  • Connecting to data
  • Managing data source metadata
  • Working with extracts instead of live connections
  • Using sets and groups
  • Filtering data

We’ll start by gaining an understanding of the underlying paradigm of how Tableau works with data.

The Tableau paradigm

The unique and exciting experience of working with data in Tableau is a result of VizQL (Visual Query Language).

VizQL was developed as a Stanford University research project, focusing on the natural ways that humans visually perceive the world and how that could be applied to data visualization. We naturally perceive differences in size, shape, spatial location, and color. VizQL allows Tableau to translate your actions, as you drag and drop fields of data in a visual environment, into a query language that defines how the data encodes those visual elements. You will never need to read, write, or debug VizQL. As you drag and drop fields onto various shelves defining size, color, shape, and spatial location, Tableau will generate the VizQL behind the scenes. This allows you to focus on visualizing data, not writing code!

One of the benefits of VizQL is that it provides a common way of describing how the arrangement of various fields in a view defines a...

Connecting to data

There is virtually no limit to the data that Tableau can visualize! Almost every new version of Tableau adds new native connectors. Tableau continues to add native connectors for cloud-based data. The web data connector allows you to write a connector for any online data you wish to retrieve. The Tableau Hyper API allows you to programmatically read and write extracts of data, enabling you to access data from any source and write it to a native Tableau format. Additionally, for any database without a built-in connection, Tableau gives you the ability to use a generic ODBC connection.

You may have multiple data sources in the same workbook. Each source will show up under the Data tab on the left sidebar.

Although the terms “data connection” and “data source” are often used interchangeably, it is helpful to make a distinction. A connection technically refers to the connection made to data in a single location, such as tables...

Managing data source metadata

Data sources in Tableau store information about the connection(s). In addition to the connection itself (for example, database server name, database, and/or filenames), the data source also contains information about all the fields available (such as field name, data type, default format, comments, and aliases). Often, this data about the data is referred to as metadata.

Right-clicking a field in the data pane reveals a menu of metadata options. Some of these options will be demonstrated in a later exercise; others will be explained throughout the book. These are some of the options available via right-clicking:

  • Renaming the field
  • Hiding the field
  • Changing aliases for values of a non-date dimension
  • Creating calculated fields, groups, sets, bins, or parameters
  • Splitting the field
  • Changing the default use of a date or numeric field to either discrete or continuous
  • Redefining the field as a dimension or...

Working with extracts instead of live connections

Nearly all data sources allow the option of either connecting live or extracting the data. A few cloud-based data sources require an extract. Conversely, OLAP data sources cannot be extracted and require live connections.

Extracts extend the way in which Tableau works with data. Consider the following diagram:

Figure 2.19: Data from the original data source is extracted into a self-contained snapshot of the data

When using a live connection, Tableau issues queries directly to the data source (or uses data in the cache, if possible). When you extract the data, Tableau pulls some or all of the data from the original source and stores it in an extract file. Prior to version 10.5, Tableau used a Tableau Data Extract (.tde) file. Starting with version 10.5, Tableau uses Hyper extracts (.hyper) and will convert .tde files to .hyper as you update older workbooks.

The fundamental paradigm of how Tableau works with data...

Using sets and groups

Sets and groups are related concepts in Tableau and both allow you to group related data together. In both cases, the grouping is defined in Tableau rather than at the source.

A group is a combination of values from one or more dimensions. For example, with the four regions Central, East, South, and West, you might choose to create two groups: East-Central and South-West. This would allow you to make new comparisons and find new insights at higher levels of geography than you might have previously. You can create a group using the context menu for a field by selecting Create | Group.

That will open a dialog box that allows you to define the groups, like this:

Graphical user interface, text, application, email  Description automatically generated

Figure 2.25: The Create Group dialog box allows you to group together values for a given dimension

The result is a field, Region (group), that you can use as you would any other dimension in your data.

You can also create ad-hoc groups by selecting marks in your visulalizations...

Filtering data

Often, you will want to filter data in Tableau in order to perform an analysis on a subset of data, narrow your focus, or drill into details. Tableau offers multiple ways to filter data.

While you may apply any number of filters to any given view, if you want to limit the scope of all your analysis to a subset of data, you can filter the data at the source using one of the following techniques:

  • Data source filters are applied before all other filters and are useful when you want to limit your analysis to a subset of data.
  • Extract filters limit the data that is stored in an extract (.tde or .hyper). Data source filters are often converted into extract filters if they are present when you extract the data.
  • Custom SQL filters can be accomplished using a live connection with custom SQL, which has a Tableau parameter in the WHERE clause. We’ll examine parameters in Chapter 4, Starting an Adventure with Calculations and Parameters.
...

Summary

This chapter covered key concepts of how Tableau works with data. Although you will not usually be concerned with what queries Tableau generates to query underlying data engines, having a solid understanding of Tableau’s paradigm will greatly aid you as you analyze data.

We looked at multiple examples of different connections to different data sources, considered the benefits and potential drawbacks of using data extracts, considered how to manage metadata, and considered options for filtering data.

Working with data is fundamental to everything you do in Tableau. Understanding how to connect to various data sources, when to work with extracts, and how to customize metadata will be key as you begin deeper analysis and more complex visualizations, such as those covered in Chapter 3, Moving Beyond Basic Visualizations.

Join our community on Discord

Join our community’s Discord space for discussions with the author and other readers: https://packt...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learning Tableau 2022 - Fifth Edition
Published in: Aug 2022Publisher: PacktISBN-13: 9781801072328
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Joshua N. Milligan

Joshua N. Milligan is a Hall of Fame Tableau Zen Master and 2017 Iron Viz Global finalist. His passion is training, mentoring, and helping people gain insights and make decisions based on their data through data visualization using Tableau and data cleaning and structuring using Tableau Prep. He is a principal consultant at Teknion Data Solutions, where he has served clients in numerous industries since 2004.
Read more about Joshua N. Milligan