![Page 1: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/1.jpg)
![Page 2: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/2.jpg)
Join us for Joins (The Joy in Joins!!)
Terrence MaasSoftware Engineer
# T C 1 8
Joanna ChenSoftware Engineer
![Page 3: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/3.jpg)
Agenda
Joins – Why the hype?
Intro to Tableau Prep
Practical Join Cases:
1. Cleaning and Filtering
2. Outer joins – Capture ALL the Values!
3. Range joins – Visualizing Occupancy
4. Self Joins – Correlations and Compositions
Q&A
![Page 4: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/4.jpg)
What’s so great about joins?
![Page 5: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/5.jpg)
Why do we use joins?
Connect Data
• Fundamental purpose of joins.
• Data derives most of its value by connecting to other data.
Reshape Data
• Different kinds of joins enable different kinds of analysis.
Select Data
• Join Conditions provide a bar for your data to meet.
• Tableau Prep uses this to help you clean your data.
![Page 6: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/6.jpg)
Terrence’s Restaurant
![Page 7: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/7.jpg)
Terrence’s Restaurant
Tables:
Employees
Schedules
Orders
Menu Items
Questions:
• Am I collecting good quality data?
• When is my restaurant busiest?
• What menu items are most popular? What about pairings?
![Page 8: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/8.jpg)
Tableau Prep!
![Page 9: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/9.jpg)
Tableau Prep
Tableau’s newest product offering
Released in April 2018
Mission Statement
Tableau Prep empowers more people to get to analysis faster by helping them quickly and confidently combine, shape, and clean their data.
![Page 10: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/10.jpg)
Tableau Prep
![Page 11: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/11.jpg)
Tableau Prep
![Page 12: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/12.jpg)
Connection Pane
![Page 13: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/13.jpg)
Flow Pane
![Page 14: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/14.jpg)
Steps in the Flow
![Page 15: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/15.jpg)
Profile Pane
![Page 16: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/16.jpg)
Changes Pane
![Page 17: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/17.jpg)
Data Grid
![Page 18: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/18.jpg)
Joins in Tableau Prep
![Page 19: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/19.jpg)
Configuring Your Join in Prep
Join Clause(s) are used to describe the relation of column(s) between two tables.
Join types are used to control how to exclude or include rows from two tables, depending on the join clauses defined above.
The Summary of Join Results shows you the distribution of values that are included and excluded from the tables in the join.
![Page 20: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/20.jpg)
Joins in Tableau Prep
![Page 21: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/21.jpg)
Join Clauses Pane
• Displays the columns from your join clause(s) side by side in 1 view
• Unmatched values are highlighted in red
![Page 22: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/22.jpg)
Joins: Getting the Most Out of Your Data
![Page 23: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/23.jpg)
Case 1: Cleaning and Filtering
![Page 24: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/24.jpg)
Case 1: Cleaning and Filtering
In every join…
Rows are matched according to the join condition.
In Tableau Prep…
We pay equal attention to both matched and unmatched data.
In general…
If a table is a source of truth, it can be a powerful tool for cleaning your data.
![Page 25: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/25.jpg)
Case 1: Cleaning and Filtering
Scenario:
• Terrence’s employees manually record restaurant orders.
• Terrence has a table of Employees, which he knows is accurate and error-free.
• He has a table of Orders that may contain errors.
![Page 26: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/26.jpg)
DEMO!
![Page 27: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/27.jpg)
Case 1: Cleaning and Filtering
Summary
• A table with reliable data can be used in a join to verify the quality of another table.
• In a join, mismatched values are accented in red.
• Clean values directly in the join pane.
![Page 28: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/28.jpg)
Case 2: Outer Joins
![Page 29: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/29.jpg)
Case 2: Outer Joins
Inner Joins
• Default join type
• Only rows that match our join clause(s) is kept in the join result
Inner Join
![Page 30: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/30.jpg)
Case 2: Outer Joins
Outer Joins
• Unmatched values can be important.
• Outer joins allow us to include unmatched data from one or more tables.
Left Join Right Join Full Outer Join
![Page 31: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/31.jpg)
Case 2: Outer Joins
Filling out dimensions/axes
• All possible values might not show up in the data.
• Some data is best represented on a complete axis / dimension.
Including unmatched values
• Outer joins allow us to include unmatched values in our result.
![Page 32: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/32.jpg)
Case 2: Outer Joins
Back to Terrence’s Restaurant…
• How is the menu doing?
• What about unordered items?
![Page 33: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/33.jpg)
Case 2: Outer Joins
Join Orders Table with Menu Table
• The Orders table alone only shows items ordered at least once.
• Use the rows from the Menu table to “fill in” the missing items not present in the Orders table.
Orders Menu
![Page 34: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/34.jpg)
DEMO!
![Page 35: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/35.jpg)
Case 2: Outer Joins
Summary
• Not every item on the menu has been ordered.
• Join Orders with Menu to fill in the complete set of orders when we visualize in Tableau.
• Change the join type from inner join to right join to include the unmatched values.
• Takeaway: use outer joins to fill out a dimension
![Page 36: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/36.jpg)
Case 2: Outer Joins
Full Outer Joins
• Not commonly used.
• Includes unmatched data from both tables in join result.
Full Outer Join
![Page 37: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/37.jpg)
Case 2: Outer Joins
Back at Terrence’s Restaurant…
• Some employees are not assigned a shift
• Some shifts do not have employees assigned
![Page 38: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/38.jpg)
DEMO!
![Page 39: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/39.jpg)
Case 2: Outer Joins
Full Outer Joins
• Every employee who has a shift assigned and every shift that has an employee assigned
• Every employee who does not have a shift assigned
• Every shift that does not have an employee assigned
![Page 40: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/40.jpg)
Case 2: Outer Joins
Summary
• Full Outer Join Employees with Schedules
• Change join type to ‘unmatched only’ to see employees without shifts and shifts without employees
![Page 41: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/41.jpg)
Case 3: Range Join Conditions
![Page 42: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/42.jpg)
Case 3: Range Join Conditions
Slowly Changing Dimensions
• Data that is best represented with start and end points.
Examples:
• Job term lengths
• Assignment durations
• Subscription times
![Page 43: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/43.jpg)
Case 3: Range Join Conditions
Manager Start Term End Term
Linda 1/1/2018 3/31/2018
Faisal 4/1/2018 7/31/2018
Ruben 8/1/2018 9/31/2018
Sales Date
10000 1/5/2018
24000 3/28/2018
6000 4/29/2018
6000 6/6/2018
30000 9/5/2018
Managers Sales
![Page 44: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/44.jpg)
Case 3: Range Join Conditions
Manager Start Term End Term Sales Date
Linda 1/1/2018 3/31/2018 10000 1/5/2018
Linda 1/1/2018 3/31/2018 24000 3/28/2018
Faisal 4/1/2018 7/31/2018 6000 4/29/2018
Faisal 4/1/2018 7/31/2018 6000 6/6/2018
Ruben 8/1/2018 9/31/2018 30000 9/5/2018
Join Conditions:managers.start_term < sales.datemanagers.end_term > sales.date
![Page 45: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/45.jpg)
Case 3: Range Join Conditions
Scenario:
My employees tell me they are usually either overwhelmed or not busy at all.
Questions I want to explore:
Am I allocating my resources in a way that accurately reflects the restaurant’s needs?
![Page 46: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/46.jpg)
DEMO!
![Page 47: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/47.jpg)
Case 4: Self Joins
![Page 48: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/48.jpg)
Case 4: Self Joins
Terrence’s favorite case!
Self Joins are…
• seldom used.
• purely a reshaping operation – no external data is connected.
• can bring wonderful insight on how values of a column relate to other values from the same column.
![Page 49: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/49.jpg)
Case 4: Self Joins
Scenario:
I’m still managing my restaurant (never give up!).
This time, I want to analyze my menu.
Questions I want to explore:
What menu items are commonly ordered together?
What do meals tend to look like compositionally?
![Page 50: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/50.jpg)
The Recipe
What we need:
1. Values we want to explore (column of interest)
2. A way they are grouped (grouping column)
3. A unique ID for each row
Examples:
Medications or conditions, grouped into patients
Menu items, grouped into meals
Etc.
![Page 51: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/51.jpg)
Join Conditions
Group_Column_1 = Group_Column_2
Column_of_Interest_1 != Column_of_Interest_2
![Page 52: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/52.jpg)
Viz: Most Common Pairings
Rows → CNTD(Row_ID_1)
Columns → Column_of_Interest_1
Filter → Column_of_Interest_2
![Page 53: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/53.jpg)
Viz 2: Group Compositions
Rows → CNTD(Row_ID_1)
Columns → Group_Column_1
Color → Column_of_Interest_1
![Page 54: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/54.jpg)
Please complete the
session survey from the My
Evaluations menu
in your TC18 app
![Page 55: Tableau Conference 2018 - The Joy in Joins · 2020. 1. 6. · Connect Data •Fundamental purpose of joins. •Data derives most of its value by connecting to other data. Reshape](https://reader036.vdocument.in/reader036/viewer/2022071219/605527be46a76e7935071063/html5/thumbnails/55.jpg)
Questions?