Joining Tables in Tableau

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

Joining Tables

Many relational data sources are made up of a collection of tables that are related by specific fields. For example, a data source for a publisher may have a table for authors that contains the first name, last name, phone number, etc. of clients.

In addition, there may be another table for titles that contains the price, royalty, and title of published books. In order to analyze these two tables together, to answer questions like, how much was paid in royalties last year for a particular author, you would join the two tables using a common field such as Author ID. That way you can view and use the fields from both tables in your analysis.

Adding Tables

You can connect to multiple tables when you first connect to a data source using the connection dialog box. There you can add tables, specify joins, and modify the field aliases in the case you have similarly named fields in each of the tables.

You can also add tables after you have already connected to the data source. This section describes how to connect to multiple tables as well as adding tables to the Data window.

Connecting to Multiple Tables

Select the table or view you want to start with (typically the fact table) and then select the Multiple Tables option.

Tableau_JoiningTables

Click the Add New Table button at the bottom of the dialog box.

Tableau_JoiningTables1

In the Add Table dialog box select a table to add to the Data window.

Tableau_JoiningTables2

These core tutorials that helps you to learn the Joining Tables in Tableau. For in-depth knowledge and practical 
experience explore Tableau Training In Bangalore.

Optionally change Field aliases.

In the bottom half of the Add Table dialog box, there is a list of fields with their aliases. Double-click the field alias to change how the field will be displayed in the Data window. This is often useful when you have duplicate field names across tables or your field names are not very understandable.

Add a join by selecting the Join tab.

Tableau will automatically create a join for you based on the structure of your data. Select the Joins tab to inspect the join clause to make sure it is how you want to connect the tables.

You can delete unwanted join clauses by selecting it in the list of join clauses and clicking Delete

In the Join pane, add one or more join clauses by selecting a field from the original table, a field from the added table, and an operator. Then click Add to add it to the list of Join Clauses.

For example, in a data source that has a table of order information and another for users information, you could join the two tables based on the Region field that exists in both tables. Select Region in both the lists of fields, select the equal sign as the operator, and click Add.

Tableau_JoiningTables3

Select the type of join from the Join Type drop-down list. You can select Inner, Left, or Right.

Please note, you cannot nest Inner joins within Left or Right joins. These joins will cause a join expression not supported error.

When finished, click OK.

The tables are listed in the Connection dialog box along with the foreign keys.

Complete the connection by giving it a name and clicking OK.

When you add joined tables, the Data window is automatically organized to use the Group by Table command. You can turn this feature off or change how the Data window is sorted using the Data window menu.

Adding Tables to the Data window

Select a data source on the Data menu and then select Edit Tables.

In the Tables dialog box, click Add New Table.

 In the Add Tables dialog box, select a table to add. Complete the dialog box by defining at least one join clause and optionally changing field aliases.

When finished, click OK and then OK again to close the dialog boxes.

When you connect to multiple tables you are essentially connecting to a denormalized view of the data source. This means that all queries are run against all tables and it is possible for some measures to be over counted.

For example, suppose you have an employees table and an orders table. However you keep the employee salary measure in the orders table. The salary will be counted for each order the employee made. Use the MIN aggregation to remove the double counting.

Editing Tables

You can modify the joined tables using the Tables command. You may want to edit a table to add or remove fields from the Data window, modify the join clause, or add more join clauses to further define how the table is connected to the original table.

Select a data source on the Data menu and then select Edit Tables.

In the Tables dialog box, select the joined table you want to modify and click Edit.

In the subsequent dialog box, you can change the table and field aliases as well as add and remove fields from the Data window. Select the Join tab to edit the join clauses.

When finished click OK twice to close the Tables dialog boxes.

For indepth knowledge on Tableau, click on below

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.