52,79 €
Learning Tableau 2022 helps you get started with Tableau and data visualization, but it does more than just cover the basic principles. It helps you understand how to analyze and communicate data visually, and articulate data stories using advanced features.
This new edition is updated with Tableau’s latest features, such as dashboard extensions, Explain Data, and integration with CRM Analytics (Einstein Analytics), which will help you harness the full potential of artificial intelligence (AI) and predictive modeling in Tableau.
After an exploration of the core principles, this book will teach you how to use table and level of detail calculations to extend and alter default visualizations, build interactive dashboards, and master the art of telling stories with data.
You’ll learn about visual statistical analytics and create different types of static and animated visualizations and dashboards for rich user experiences. We then move on to interlinking different data sources with Tableau’s Data Model capabilities, along with maps and geospatial visualization. You will further use Tableau Prep Builder’s ability to efficiently clean and structure data.
By the end of this book, you will be proficient in implementing the powerful features of Tableau 2022 to improve the business intelligence insights you can extract from your data.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 661
Veröffentlichungsjahr: 2022
Learning Tableau 2022
Fifth Edition
Create effective data visualizations, build interactive visual analytics, and improve your data storytelling capabilities
Joshua N. Milligan
BIRMINGHAM—MUMBAI
Learning Tableau 2022
Fifth Edition
Copyright © 2022 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Senior Publishing Product Manager: Devika Battike
Acquisition Editor – Peer Reviews: Saby Dsilva
Project Editor: Parvathy Nair
Content Development Editor: Edward Doxey
Copy Editor: Safis Editing
Technical Editor: Karan Sonawane
Proofreader: Safis Editing
Indexer: Hemangini Bari
Presentation Designer: Rajesh Shirsath
First published: April 2015
Second edition: September 2016
Third edition: March 2019
Fourth edition: August 2020
Fifth edition: August 2022
Production reference: 3130223
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-80107-232-8
www.packt.com
Tableau’s long-established company mission has been to help people see and understand data. That mission has changed how people work and how decisions are made. The utility of technology is in large part made possible by the community of Tableau enthusiasts that make data dreams into a reality, and Joshua Milligan’s impact on the community is rivaled by few. As testament to that, he was recently inducted into the Tableau Visionary Hall of Fame for his contributions to the Tableau community as a thought leader, teacher, and author; this book is another outstanding addition.
As leaders in the business intelligence space for over a decade (as named in the Gartner Magic Quadrant), Tableau has grown from a visualization tool to an analytical platform helping organizations of all sizes make data-driven decisions. Tableau continues to win the hearts of analysts due to its vast connectivity options and the endless ways you can explore your data. With Tableau, anyone can create beautiful, interactive visualizations to tell a story with data.
For those looking to get started with Tableau or take their skills to new heights, Milligan’s Learning Tableau 2022 is a great place to start unlocking the unlimited potential of data. As an expert in his field, Milligan has honed his skills and demonstrated them at the highest level (check out his Tableau Public page!), and this fifth edition captures his recipe for Tableau mastery. Having worked with Tableau users for the better half of a decade myself, I appreciate how this book focuses on how and why to visualize data the right way.
For anyone looking to use data to make decisions, this book is a must-have in your arsenal.
– Blair Hutchinson,
Senior Product Manager, Tableau, a Salesforce Company
Data has been called the new oil. However, I agree with David McCandless, author of Information is Beautiful, when he claims that data is instead the new soil. Information is the fertile medium in which businesses can build their customer base, empower their people, and improve our society. Rich fruit can spring up from this marvellous loam—a harvest of insights, efficiency, intelligence, equality, and prosperity. Truly, the soil of data can yield crops that can transform the world in which we live and work. Therefore, those who would cultivate this rich and fertile ground must be equipped with the very best of tools—technology that will enable business users and data specialists to understand, interpret and action the data that can so easily be underutilized. Tableau is such a tool.
However, even the best of tools is completely useless without skilled professionals who can use it to its full potential—and such data champions are not as common as we would wish. We suffer from an undersupply of capable Tableau users and gurus, and there is no easy answer to this challenge.
In his exemplary work, Learning Tableau 2022, Joshua Milligan seeks to alleviate this famine of talent, and I believe that he has done a marvellous job of doing so. This book strikes a delicate balance between succinctness and completeness (no mean feat!), and provides you with a thorough, readable, and practical guide to learning Tableau. Joshua makes learning Tableau a progressive, enjoyable experience, and for that he deserves our applause.
Learning Tableau 2022 will get you up and running with Tableau in next to no time, enabling you to quickly experience the power and versatility of the world’s leading data visualization platform. You will then progress from simple visualizations to building advanced analytics using multiple data sources, and more, all while learning from Joshua’s real-world experience.
I am very excited about this book, and I highly recommend it to any new or existing Tableau customer looking to transform their business with data.
- Mark Tossell,
Lead Solution Engineer, Tableau, a Salesforce Company
Every digital transformation is a data transformation. Data is at the heart of our businesses and lives—in 2021 alone it’s estimated the world produced 79 zettabytes of data, and this number is growing every year. The problem, then, isn’t gathering data. It’s understanding how to make sense of and extract insights from data, making it usable in decision-making processes.
This is the role of Tableau, a solution that can completely change the way companies analyze data and make decisions. Since 2019 Tableau has been part of Salesforce’s Customer 360 application suite. Every one of those applications is built upon, and generates, amazing amounts of data showing how to interact with your customers. Tableau brings the ability to analyze and act on this amount of data in a well-governed scalable way.
During the last Tableau Conference, we announced key enhancements to simplify and democratize information access. To mention just a few of them: we introduced Tableau Cloud, a new premier analytics experience, the next generation of Tableau Online. This is the fastest way for customers to get the full value of Tableau at enterprise scale. We announced the Tableau Accelerators (for specific business roles and industries use cases), ready-to-use fully customizable templates that help organizations get insights and value from their data fast. We introduced Data Stories, a powerful data storytelling feature in Tableau that makes it easy for anyone to understand data, democratizing access to data insights for every role in an organization. These are just a few examples, and it is just the beginning of our amazing journey! Later in 2022 we will release new AI-driven functionalities like Model Builder, a new way to leverage the power of Salesforce’s Einstein and develop linear and tree-based machine learning models directly in Tableau.
The list of technical capabilities may be infinite, but we cannot provide full value to our customers with technology alone; we need to help the organization to become data-driven. However, becoming a data-driven organization is not just a matter of product functionalities, it’s a matter of data culture and skills. With this in mind, there is another topic that I would love to bring to your attention: data literacy. Data literacy is an ability to explore, understand, and communicate with data. It includes critical thinking skills to use, interpret, and make decisions with data, then convey its significance and value to others. Improving this ability is the only way to unlock the power of data and optimize your investments on technology. In line with this belief, I love the work done by Joshua N. Milligan in his new book. It’s a well-designed book with a very good flow and step-by-step examples, that doesn’t require pre-existing industry knowledge. After reading this book you will have gained a good understanding of Tableau, and you will be ready to delve deeper into more specific topics and new functionalities.
If you’re reading this foreword, you’re on the right path to learning a market leader solution that will provide massive value to you and your organisation. Enjoy the reading and if you want to connect with me, feel free to reach me out on LinkedIn.
- Roberto Andreoli,
Senior Director Solution Engineering Tableau, South EMEA, Salesforce
Joshua N. Milligan has been recognized as a Tableau Visionary (formerly Zen Master) every year since 2014 and is now in the Tableau Hall of Fame. This is the highest honor bestowed by Tableau, recognizing technical mastery and service to the community. He is also a global Iron Viz finalist.
Since 2004, Joshua has been a consultant at Teknion Data Solutions until acquisition by Resultant in 2022, where he continues to serve clients in numerous industries.
He is the author of every edition of Learning Tableau and resides in Tulsa with his wife and four children.
I am extremely grateful for those who have shaped my journey. My father, Stuart, introduced me to computers. My colleagues challenge me to grow every day. The Tableau DataFam provides a wealth of ideas, inspiration, and a place to share. I am especially thankful for my wife, Kara, who has encouraged me and loved me every step of the way!
Born and raised in Germany, Marleen Meier moved to Amsterdam after graduating from University with a masters’ degree in Mathematics and Sport Science. She worked as a data analyst and later on as a quantitative risk analyst before eventually moving to Chicago, US, where she now works in the risk analytics space. Since 2018, Marleen has worked with Packt, and has published Mastering Tableau 2019 as well as Mastering Tableau 2021.
Candra Mcrae is a Lead Solutions Engineer at Tableau, and an experienced analytics leader helping companies identify opportunities, execute, and scale by putting their data to work for them. She is also a previous #TC18 speaker, former featured author, a featured speaker with The Maple Square, and mentor. When she is not showing others how to understand their data or how to tell data stories that inspire action, she enjoys moving the conversation forward related to diversity in tech and data ethics. Outside of her day job, she is a proud wife and mother of one, experimental baker, music lover, and avid traveler.
Join our community’s Discord space for discussions with the author and other readers: https://packt.link/ips2H
Preface
Who this book is for
What this book covers
To get the most out of this book
Get in touch
Taking Off with Tableau
Foundations for building visualizations
Measures and dimensions
Discrete and continuous fields
Discrete fields
Continuous fields
Visualizing data
Bar charts
Line charts
Iterations of line charts for deeper analysis
Geographic visualizations
Filled maps
Symbol maps
Density maps
Using Show Me
Putting everything together in a dashboard
The dashboard interface
Building your dashboard
Summary
Connecting to Data in Tableau
The Tableau paradigm
The Tableau paradigm in action
Connecting to data
Connecting to data in a file
Connecting to data on a server
Connecting to data in the cloud
Shortcuts for connecting to data
Managing data source metadata
Working with extracts instead of live connections
Creating extracts
Using extracts
Performance
Portability and security
When to use an extract
Using sets and groups
Filtering data
Filtering discrete (blue) fields
Filtering continuous (green) fields
Filtering dates
Other filtering options
Tableau Order of Operations
Summary
Moving Beyond Basic Visualizations
Comparing values
Bar charts
Bar chart variations
Bullet chart
Bar-in-bar chart
Highlighting categories of interest
Visualizing dates and times
Date parts, date values, and exact dates
Variations of date and time visualizations
Gantt charts
Relating parts of the data to the whole
Stacked bars
Treemaps
Area charts
Pie charts
Visualizing distributions
Circle charts
Jittering
Box and whisker plots
Histograms
Visualizing multiple axes to compare different measures
Scatterplot
Dual-axis and combination charts
Summary
Starting an Adventure with Calculations and Parameters
Introduction to calculations
The four main types of calculations
Creating and editing calculations
Data types
Additional functions and operators
Understanding the data used in chapter examples
Row-level calculations
Concatenating strings
String manipulation and conditional logic
Planning for data variations
Aggregate calculations
Why the row-level versus aggregate difference matters
Parameters
Creating parameters
Practical examples of calculations and parameters
Fixing data issues
Extending the data
Enhancing user experience, analysis, and visualizations
Meeting business requirements
Ad hoc calculations
Performance considerations
Summary
Leveraging Level of Detail Calculations
Overview of level of detail
Level of detail calculations
Level of detail syntax
Level of detail types
Fixed
Include
Exclude
An illustration of the difference level of detail can make
Examples of fixed level of detail calculations
Flagging members based on historical values
Latest balance for a member
Examples of include level of detail expressions
Average loans per member
Alternative approaches
Example of exclude level of detail calculations
Average credit score per loan type
Summary
Diving Deep with Table Calculations
An overview of table calculations
Creating and editing table calculations
Quick table calculations
Fundamental table calculation concepts
Relative versus fixed
Scope and direction
Addressing and partitioning
Custom table calculations
Meta table functions
Lookup and previous value
Running functions
Window functions
Rank functions
Script functions
The Total function
Practical examples
Year over year growth
Dynamic titles with totals
Table calculation filtering (late filtering)
Summary
Making Visualizations that Look Great and Work Well
Visualization considerations
Leveraging formatting in Tableau
Workbook-level formatting
Worksheet-level formatting
Field-level formatting
Custom number formatting
Custom date formatting
Null formatting
Additional formatting options
Adding value to visualizations
Tooltips
Viz in Tooltip
Summary
Telling a Data Story with Dashboards
Introduction to dashboards
Dashboard objectives
Dashboard approaches
Designing dashboards in Tableau
Using objects
Tiled versus floating
Manipulating objects on the dashboard
A dashboard to understand profitability
Building the views
Creating the dashboard framework
Implementing actions to guide the story
Context filtering
Designing for different displays and devices
Interactivity with actions
Filter actions
Highlight actions
URL actions
Go to Sheet actions
Parameter actions
Set actions
A regional scorecard dashboard
Stories
Summary
Visual Analytics: Trends, Clustering, Distributions, and Forecasting
Trends
Customizing trend lines
Trend models
Linear
Logarithmic
Exponential
Power
Polynomial
Analyzing trend models
Exporting statistical model details
Explain Data
Clustering
Distributions
Forecasting
Summary
Advanced Visualizations
Advanced visualizations – when and why to use them
Slope charts and bump charts
Waterfall charts
Step lines and jump lines
Sparklines
Dumbbell charts
Unit/symbol charts
Marimekko charts
Animated visualizations
Enhancing analysis with animation
Enhancing data storytelling with animation
Summary
Dynamic Dashboards
Show/Hide buttons
Sheet swapping
Basic principles of sheet swapping
Using sheet swapping to change views on a dashboard
Automatically showing and hiding other controls
Summary
Exploring Mapping and Advanced Geospatial Features
Overview of Tableau maps
Rendering maps with Tableau
Customizing map layers
Customizing map options
Using geospatial data
Including latitude and longitude in your data
Importing definitions into Tableau’s geographic database
Leveraging spatial objects
Leveraging spatial functions
MAKELINE() and MAKEPOINT()
DISTANCE()
BUFFER()
Creating custom territories
Ad hoc custom territories
Field-defined custom territories
Map layers
Tableau mapping – tips and tricks
Plotting data on background images
Summary
Integrating Advanced Features: Extensions, Scripts, and AI
Tableau Dashboard Extensions
What Is a Dashboard Extension?
Using a dashboard extension
Creating an extension
Setting up your environment
The files and code that define the dashboard extension
The dashboard extension in action
Tableau analytics extensions
Scripting with Python
Setting up TabPy
Using a Python script in Tableau
AI with CRM Analytics (Einstein Discovery)
The data used in the examples
Creating the Einstein Discovery story
Leveraging AI with Einstein in Tableau
Using the Einstein analytics extension
Using the Einstein dashboard extension
Summary
Understanding the Tableau Data Model, Joins, and Blends
Explanation of the sample data used in this chapter
Exploring the Tableau data model
Creating a data model
Layers of the data model
Using the data model
The data pane interface
Data model behaviors
Using joins
Types of joins
Joining tables
Other join considerations
Join calculations
Cross-database joins
The unintentional duplication of data
Using blends
Using blending to show progress toward a goal
When to use a data model, joins, or blends
Summary
Structuring Messy Data to Work Well in Tableau
Structuring data for Tableau
Well-structured data in Tableau
Wide data
Tall data
Wide versus tall data in Tableau
Star schemas
The four basic data transformations
Overview of transformations
Pivots (along with some simple data cleaning)
Unions
Joins
Aggregation
Overview of advanced fixes for data problems
Summary
Taming Data with Tableau Prep
Getting ready to explore Tableau Prep Builder
Understanding the Tableau Prep Builder interface
Flowing with the fundamental paradigm
Connecting to data
Cleaning the data
Unioning and merging mismatched fields, and removing unnecessary fields
Grouping and cleaning
Calculations and aggregations in Tableau Prep
Row-level calculations
Level of detail calculations
Aggregations
Filtering data in Tableau Prep
Transforming the data for analysis
Using parameters in Tableau Prep Builder
Options for automating flows
Summary
Sharing Your Data Story
Presenting, printing, and exporting
Presenting
Printing
Exporting
Sharing with users of Tableau Desktop and Tableau Reader
Sharing with Tableau Desktop users
Sharing with Tableau Reader users
Sharing with users of Tableau Server, Tableau Cloud, and Tableau Public
Publishing to Tableau Public
Publishing to Tableau Server and Tableau Cloud
Using the Workbook Optimizer to maximize performance on Server or Cloud
Interacting with Tableau Server
Leveraging Ask Data for a natural language guided analysis
Additional distribution options using Tableau Server or Tableau Cloud
Summary
Other Books You May Enjoy
Index
Cover
Index
Once you’ve read Learning Tableau 2022, Fifth Edition, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.
Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.
Thanks for purchasing this book!
Do you like to read on the go but are unable to carry your print books everywhere?Is your eBook purchase not compatible with the device of your choice?
Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.
Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.
The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily
Follow these simple steps to get the benefits:
Scan the QR code or visit the link belowhttps://packt.link/free-ebook/9781801072328
Submit your proof of purchaseThat’s it! We’ll send your free PDF and other benefits to your email directlyTableau is an amazing platform for seeing, understanding, and making key decisions based on your data! With it, you will be able to carry out incredible data discovery, analysis, and storytelling. You’ll accomplish these tasks and goals visually using an interface that is designed for a natural and seamless flow of thought and work.
You don’t need to write complex scripts or queries to leverage the power of Tableau. Instead, you will be interacting with your data in a visual environment where everything that you drag and drop will be translated into the necessary queries for you and then displayed visually. You’ll be working in real time, so you will see results immediately, get answers as quickly as you can ask questions, and be able to iterate through potentially dozens of ways to visualize the data in order to find a key insight or tell a piece of the story.
This chapter introduces the foundational principles of Tableau. We’ll go through a series of examples that will introduce you to the basics of connecting to data, exploring and analyzing data visually, and finally putting it all together in a fully interactive dashboard. These concepts will be developed far more extensively in subsequent chapters. However, don’t skip this chapter, as it introduces key terminology and concepts, including the following:
Connecting to dataFoundations for building visualizationsCreating bar chartsCreating line chartsCreating geographic visualizationsUsing Show MeBringing everything together in a dashboardLet’s begin by looking at how you can connect Tableau to your data.
Connecting to data
Tableau connects to data stored in a wide variety of files and databases. This includes flat files, such as Excel documents, spatial files, and text files; relational databases, such as SQL Server and Oracle; cloud-based data sources, such as Snowflake and Amazon Redshift; and Online Analytical Processing (OLAP)data sources, such as Microsoft SQL Server Analysis Services. With very few exceptions, the process of analysis and creating visualizations will be the same, no matter what data source you use.
We’ll cover data connections and related topics more extensively throughout the book. For example, we’ll cover the following:
Connecting to a wide variety of different types of data sources in Chapter 2, Connecting to Data in TableauUsing joins, blends, and object model connections in Chapter 14, Understanding the Tableau Data Model, Joins, and BlendsUnderstanding the data structures that work well and how to deal with messy data in Chapter 15, Structuring Messy Data to Work Well in TableauLeveraging the power and flexibility of Tableau Prep to cleanse and shape data for deeper analysis in Chapter 16, Taming Data with Tableau PrepIn this chapter, we’ll connect to a text file derived from one of the sample datasets that ships with Tableau: Superstore.csv. Superstore is a fictional retail chain that sells various products to customers across the United States and the file contains a record for every line item of every order with details on the customer, location, item, sales amount, and revenue.
Please use the supplied Superstore.csv data file instead of the Tableau sample data, as there are differences that will change the results. Instructions for downloading all the samples are in the preface.
The Chapter 1 workbooks, included with the code files bundle, already have connections to the file; however, for this example, we’ll walk through the steps of creating a connection in a new workbook:
Open Tableau. You should see the home screen with a list of connection options on the left and, if applicable, thumbnail previews of recently edited workbooks in the center, along with sample workbooks at the bottom.Under Connect and To a File, click on Text File.In the Open dialog box, navigate to the \Learning Tableau\Chapter 01 directory and select the Superstore.csv file.You will now see the data connection screen, which allows you to visually create connections to data sources. We’ll examine the features of this screen in detail in the Connecting to data section of Chapter 2, Connecting to Data in Tableau. For now, Tableau has already added a preview of the file for the connection:
Figure 1.1: The data connection screen allows you to build a connection to your data
For this connection, no other configuration is required, so simply click on the Sheet 1 tab at the bottom of the Tableau window to start visualizing the data! You should now see the main work area within Tableau, which looks like this:
Figure 1.2: Elements of Tableau’s primary interface, numbered with descriptions below
We’ll refer to elements of the interface throughout the book using specific terminology, so take a moment to familiarize yourself with the terms used for various components numbered in the preceding screenshot:
The menu contains various menu items for performing a wide range of functions.The toolbar allows common functions such as undo, redo, save, add a data source, and so on.The Data pane is active when the Data tab is selected and lists all tables and fields of the selected data source. The Analytics paneis active when the Analytics tab is selected and gives options for supplementing visualizations with visual analytics.Various shelves such as Pages, Columns, Rows, and Filters serve as areas to drag and drop fields from the data pane. The Marks card contains additional shelves such as Color, Size, Text, Detail, and Tooltip. Tableau will visualize data based on the fields you drop onto the shelves.Data fields in the Data pane are available to add to a view. Fields that have been dropped onto a shelf are called in the view or active fields because they play an active role in the way Tableau draws the visualization.
A Tableau workbook is a collection of data sources, sheets, dashboards, and stories. All of this is saved as a single Tableau workbook file (.twb or .twbx). A workbook is organized into a collection of tabs of various types:
A sheet is a single data visualization, such as a bar chart or a line graph. Since sheet is also a generic term for any tab, we’ll often refer to a sheet as a view because it is a single view of the data.A dashboard is a presentation of any number of related views and other elements (such as text or images) arranged together as a cohesive whole to communicate a message to an audience. Dashboards are often designed to be interactive.A story is a collection of dashboards or single views that have been arranged to communicate a narrative from the data. Stories may also be interactive.Along the bottom of the screen, you’ll notice a few other items. As you work, a status bar at the bottom left will display important information and details about the view, selections, and the user. Although obscured by the Show Me window in Figure 1.1, you’ll find other controls at the bottom right that allow you to navigate between sheets, dashboards, and stories, as well as viewing the tabs with Show Filmstrip or switching to a sheet sorter showing an interactive thumbnail of all sheets in the workbook.
Now that you have connected to the data in the text file, we’ll explore some examples that lay the foundation for data visualization and then move on to building some foundational visualization types. To prepare for this, please do the following:
From the menu, select File | Exit.When prompted to save changes, select No.From the \learning Tableau\Chapter 01 directory, open the file Chapter 01 Starter.twbx. This file contains a connection to the Superstore data file and is designed to help you walk through the examples in this chapter.The files for each chapter include a Starter workbook that allows you to work through the examples given in this book. If, at any time, you’d like to see the completed examples, open the Complete workbook for the chapter.
Having made a connection to the data, you are ready to start visualizing and analyzing it. As you begin to do so, you will take on the role of an analyst at the retail chain. You’ll ask questions of the data, build visualizations to answer those questions, and ultimately design a dashboard to share the results. Let’s start by laying some foundations for understanding how Tableau visualizes data.
When you first connect to a data source such as the Superstore file, Tableau will display the data connection and the fields in the Data pane. Fields can be dragged from the data pane onto the canvas area or onto various shelves such as Rows, Columns, Color, or Size. As we’ll see, the placement of the fields will result in different encodings of the data based on the type of field.
The fields from the data source are visible in the Data pane and are divided into Measures and Dimensions.
Prior to Tableau 2020.2, these are separate sections in the Data pane. In newer versions, each table will have Measures and Dimensions separated by a line:
Figure 1.3: Each table (this data source only has one) has dimensions listed above the line and measures listed below the line
The difference between Measures and Dimensions is a fundamental concept to understand when using Tableau:
Measures are values that are aggregated. For example, they are summed, averaged, or counted, or the result is the minimum or maximum value.Dimensions are values that determine the level of detail at which measures are aggregated. You can think of them as slicing the measures or creating groups into which the measures fit. The combination of dimensions used in the view defines the view’s basic level of detail.As an example (which you can view in the Chapter 01 Starter workbook on the Measures and Dimensions sheet), consider a view created using the Region and Sales fields from the Superstore connection:
Figure 1.4: A bar chart demonstrating the use of Measures and Dimensions
The Sales field is used as a measure in this view. Specifically, it is being aggregated as a sum. When you use a field as a measure in the view, the type aggregation (for example, SUM, MIN, MAX, and AVG) will be shown on the active field. Note that, in the preceding example, the active field on Rows clearly indicates the sum aggregation of Sales: SUM(Sales).
The Regionfield is a dimension with one of four values for each record of data: Central, East, South, or West. When the field is used as a dimension in the view, it slices the measure. So, instead of an overall sum of sales, the preceding view shows the sum of sales for each region.
Another important distinction to make with fields is whether a field is being used as discrete or continuous. Whether a field is discrete or continuous determines how Tableau visualizes it based on where it is used in the view. Tableau will give a visual indication of the default value for a field (the color of the icon in the Data pane) and how it is being used in the view (the color of the active field on a shelf). Discrete fields, such as Region in the previous example, are blue. Continuous fields, such as Sales, are green.
Discrete(blue) fields have values that are shown as distinct and separate from one another. Discrete values can be reordered and still make sense. For example, you could easily rearrange the values of Region to be East, South, West, and Central, instead of the default order in Figure 1.4.
When a discrete field is used on the Rows or Columns shelves, the field defines headers. Here, the discrete field Region defines the column headers:
Figure 1.5: The discrete field on Columns defines column headers
Here, it defines the row headers:
Figure 1.6: The discrete field on Rows defines row headers
When used for Color, a discrete field defines a discrete color palette in which each color aligns with a distinct value of the field:
Figure 1.7: The discrete field on Color defines a discrete color palette
Continuous (green) fields have values that flow from first to last as a continuum. Numeric and date fields are often (though, not always) used as continuous fields in the view. The values of these fields have an order that it would make little sense to change.
When used on Rows or Columns, a continuous field defines an axis:
Figure 1.8: The continuous field on Columns (or Rows) defines an axis
When used for Color, a continuous field defines a gradient:
Figure 1.9: The continuous field on Color defines a gradient color palette
It is very important to note that continuous and discrete are different concepts from measure and dimension. While most dimensions are discrete by default, and most measures are continuous by default, it is possible to use any measure as a discrete field and some dimensions as continuous fields in the view, as shown here:
Figure 1.10: Measures and dimensions can be discrete or continuous
To change the default setting of a field, right-click on the field in the Data pane and select Convert to Discrete or Convert to Continuous.
To change how a field is used in the view, right-click on the field in the view and select Discrete or Continuous. Alternatively, you can drag and drop the fields between Dimensions and Measures in the Data pane, which will automatically convert the field.
In general, you can think of the differences between the types of fields as follows:
Choosing between a dimension and measure tells Tableau how to slice or aggregate the data.Choosing between discrete and continuous tells Tableau how to display the data with a header or an axis and defines individual colors or a gradient.As you work through the examples in this book, pay attention to the fields you are using to create the visualizations, whether they are dimensions or measures, and whether they are discrete or continuous. Experiment with changing fields in the view from continuous to discrete, and vice versa, to gain an understanding of the differences in the visualization. We’ll put this understanding into practice as we turn our attention to visualizing data.
A new connection to a data source is an invitation to explore and discover! At times, you may come to the data with very well-defined questions and a strong sense of what you expect to find. Other times, you will come to the data with general questions and very little idea of what you will find. The visual analytics capabilities of Tableau empower you to rapidly and iteratively explore the data, ask new questions, and make new discoveries.
The following visualization examples cover a few of the most foundational visualization types. As you work through the examples, keep in mind that the goal is not simply to learn how to create a specific chart. Rather, the examples are designed to help you think through the process of asking questions of the data and getting answers through iterations of visualization. Tableau is designed to make that process intuitive, rapid, and transparent.
Something that is far more important than memorizing the steps to create a specific chart type is understanding how and why to use Tableau to create a chart and being able to adjust your visualization to gain new insights as you ask new questions.
Bar charts visually represent data in a way that makes the comparison of values across different categories easy. The length of the bar is the primary means by which you will visually understand the data. You may also incorporate color, size, stacking, and order to communicate additional attributes and values.
Creating bar charts in Tableau is very easy. Simply drag and drop the measure you want to see onto either the Rows or Columns shelf and the dimension that defines the categories onto the opposing Rows or Columns shelf.
As an analyst for Superstore, you are ready to begin a discovery process focused on sales (especially the dollar value of sales). As you follow the examples, work your way through the sheets in the Chapter 01 Starter workbook. The Chapter 01 Complete workbook contains the complete examples so that you can compare your results at any time:
Click on the Sales by Department tab to view that sheet.Drag and drop the Sales field from Measures in the Data pane onto the Columns shelf. You now have a bar chart with a single bar representing the sum of sales for all of the data in the data source.Drag and drop the Department field from Dimensions in the Data pane to the Rows shelf. This slices the data to give you three bars, each having a length that corresponds to the sum of sales for each department:Figure 1.11: The view Sales by Department should look like this when you have completed the preceding steps
You now have a horizontal bar chart. This makes comparing the sales between the departments easy. The type drop-down menu on the Marks card is set to Automatic and indicates that Tableau has determined that bars are the best visualization given the fields you have placed in the view. As a dimension, Department slices the data. Being discrete, it defines row headers for each department in the data. As a measure, the Sales field is aggregated. Being continuous, it defines an axis. The mark type of bar causes individual bars for each department to be drawn from 0 to the value of the sum of sales for that department.
Typically, Tableau draws a mark (such as a bar, a circle, or a square) for every combination of dimensional values in the view. In this simple case, Tableau is drawing a single bar mark for each dimensional value (Furniture, Office Supplies, and Technology) of Department. The type of mark is indicated and can be changed in the drop-down menu on the Marks card. The number of marks drawn in the view can be observed on the lower-left status bar.
Tableau draws different marks in different ways; for example, bars are drawn from 0 (or the end of the previous bar, if stacked) along the axis. Circles and other shapes are drawn at locations defined by the value(s) of the field that is defining the axis. Take a moment to experiment with selecting different mark types from the drop-down menu on the Marks card. A solid grasp of how Tableau draws different mark types will help you to master the tool.
Iterations of bar charts for deeper analysis
Using the preceding bar chart, you can easily see that the Technology department has more total sales than either the Furniture or Office Supplies departments. What if you want to further understand sales amounts for departments across various regions? Follow these two steps:
Navigate to the Bar Chart (two levels) sheet, where you will find an initial view that is identical to the one you created earlier.Drag the Region field from Dimensions in the Data pane to the Rows shelf and drop it to the left of the Department field already in view.You should now have a view that looks like this:
Figure 1.12: The view, Bar Chart (two levels), should look like this when you have completed the preceding steps
You still have a horizontal bar chart, but now you’ve introduced Region as another dimension, which changes the level of detail in the view and further slices the aggregate of the sum of sales. By placing Region before Department, you can easily compare the sales of each department within a given region.
Now you are starting to make some discoveries. For example, the Technology department has the most sales in every region, except in the East, where Furniture had higher sales. Office Supplies has never had the highest sales in any region.
Consider an alternate view, using the same fields arranged differently:
Navigate to the Bar Chart (stacked) sheet, where you will find a view that is identical to the original bar chart.Drag the Region field from the Rows shelf and drop it onto the Color shelf:Figure 1.13: The Bar Chart (stacked) view should look like this
Instead of a side-by-side bar chart, you now have a stacked bar chart. Each segment of the bar is color-coded by the Region field. Additionally, a color legend has been added to the workspace. You haven’t changed the level of detail in the view, so sales are still summed for every combination of Region and Department.
The view level of detail is a key concept when working with Tableau. In most basic visualizations, the combination of values of all dimensions in the view defines the lowest level of detail for that view. All measures will be aggregated or sliced by the lowest level of detail. In the case of most simple views, the number of marks (indicated in the lower-left status bar) corresponds to the number of unique combinations of dimensional values. That is, there will be one mark for each combination of dimension values.
Consider how the view level of detail changes based on the fields used in the view:
If Department is the only field used as a dimension, you will have a view at the department level of detail, and all measures in the view will be aggregated per department.If Region is the only field used as a dimension, you will have a view at the region level of detail, and all measures in the view will be aggregated per region.If you use both Department and Region as dimensions in the view, you will have a view at the level of department and region. All measures will be aggregated per unique combination of department and region, and there will be one mark for each combination of department and region.Stacked bars can be useful when you want to understand part-to-whole relationships. It is now easier to see what portion of the total sales of each department is made in each region. However, it is very difficult to compare sales for most of the regions across departments. For example, can you easily tell which department had the highest sales in the East region? It is difficult because, with the exception of the West region, every segment of the bar has a different starting point.
Now take some time to experiment with the bar chart to see what variations you can create:
Navigate to the Bar Chart (experimentation) sheet.Try dragging the Region field from Color to the other various shelves on the Marks card, such as Size, Label, and Detail. Observe that in each case the bars remain stacked but are redrawn based on the visual encoding defined by the Region field.Use the Swap button on the toolbar to swap fields on Rows and Columns. This allows you to very easily change from a horizontal bar chart to a vertical bar chart (and vice versa):Figure 1.14: Swap Rows and Columns button
Drag and drop Sales from the Measures section of the Data pane on top of the Region field on the Marks card to replace it. Drag the Sales field to Color if necessary and notice how the color legend is a gradient for the continuous field.Experiment further by dragging and dropping other fields onto various shelves. Note the behavior of Tableau for each action you take.From the File menu, select Save.If your OS, machine, or Tableau stops unexpectedly, then the Autosave feature should protect your work. The next time you open Tableau, you will be prompted to recover any previously open workbooks that had not been manually saved. You should still develop a habit of saving your work early and often, though, and maintaining appropriate backups.
As you continue to explore various iterations, you’ll gain confidence with the flexibility available to visualize your data.
Line charts connect related marks in a visualization to show movement or a relationship between those connected marks. The position of the marks and the lines that connect them are the primary means of communicating the data. Additionally, you can use size and color to communicate additional information.
The most common kind of line chart is a time series. A time series shows the movement of values over time. Creating one in Tableau requires only a date and a measure.
Continue your analysis of Superstore sales using the Chapter 01 Starter workbook you just saved:
Navigate to the Sales over time sheet.Drag the Sales field from Measures to Rows. This gives you a single, vertical bar representing the sum of all sales in the data source.To turn this into a time series, you must introduce a date. Drag the Order Date field from Dimensions in the Data pane on the left and drop it into Columns. Tableau has a built-in date hierarchy, and the default level of Year has given you a line chart connecting four years. Notice that you can clearly see an increase in sales year after year:Figure 1.15: An interim step in creating the final line chart; this shows the sum of sales by year
Use the drop-down menu on the YEAR(Order Date) field on Columns (or right-click on the field) and switch the date field to use Quarter. You may notice that Quarter is listed twice in the drop-down menu. We’ll explore the various options for date parts, values, and hierarchies in the Visualizing dates and times section of Chapter 3, Moving Beyond Basic Visualizations. For now, select the second option:Figure 1.16: Select the second Quarter option in the drop-down menu.
Notice that the cyclical pattern is quite evident when looking at sales by quarter:Figure 1.17: Your final view shows sales over each quarter for the last several years
Let’s consider some variations of line charts that allow you to ask and answer even deeper questions.
Right now, you are looking at the overall sales over time. Let’s do some analysis at a slightly deeper level:
Navigate to the Sales over time (overlapping lines) sheet, where you will find a view that is identical to the one you just created.Drag the Region field from Dimensions to Color. Now you have a line per region, with each line a different color, and a legend indicating which color is used for which region. As with the bars, adding a dimension to Color splits the marks. However, unlike the bars, where the segments were stacked, the lines are not stacked. Instead, the lines are drawn at the exact value for the sum of sales for each region and quarter. This allows easy and accurate comparison. It is interesting to note that the cyclical pattern can be observed for each region:Figure 1.18: This line chart shows the sum of sales by quarter with different colored lines for each region
With only four regions, it’s relatively easy to keep the lines separate. But what about dimensions that have even more distinct values? Let’s consider that case in the following example:
Navigate to the Sales over time (multiple rows) sheet, where you will find a view that is identical to the one you just created.Drag the Category field from Dimensions and drop it directly on top of the Region field currently on the Marks card. This replaces the Region field with Category. You now have 17 overlapping lines. Often, you’ll want to avoid more than two or three overlapping lines. But you might also consider using color or size to showcase an important line in the context of the others. Also, note that clicking on an item in the Color legend will highlight the associated line in the view. Highlighting is an effective way to pick out a single item and compare it to all the others.Drag the Category field from Color on the