Tableau Data Connections to Databases & Multiple Sources

โšก Smart Summary

Tableau Data Connections cover every route data takes into a workbook, from flat files to live databases, web connectors, and published server sources. This page walks through each connection type, joins, unions, sorting, and source replacement.

  • ๐Ÿ“ File Sources: Text, Excel, and PDF files connect straight from the Data tab, with no driver setup.
  • ๐Ÿ—„๏ธ Database Sources: Native and ODBC connectors reach MySQL, Oracle, and other servers using host, port, and credentials.
  • ๐Ÿ”— Combining Tables: Joins match rows on a key, unions stack matching headers, and relationships defer the join until a view runs.
  • ๐Ÿ”ข Join Types: Inner, left, right, and outer joins decide which unmatched rows survive; Tableau accepts 32 tables per source.
  • โ™ป๏ธ Source Replacement: Swapping a source keeps existing sheets intact if the replacement retains every used dimension and measure.

Tableau Data Connections

In this Tableau Data Connections tutorial, you will learn about different data sources or data connections in Tableau.

Tableau Connecting to Various Data Sources

Tableau can connect to various types of data sources. It can connect to text files, excel files, PDF files, etc. It can also connect to various databases using its ODBC connector, as well as to servers and web connectors. The sections below cover the connection procedure for each of these Tableau data sources.

Following screenshot gives the exhaustive connection types Tableau supports

Tableau Connecting to Various Data Sources

File-based sources sit on the left of that pane and servers in the middle. The sections below follow the same order.

Connecting to Text File in Tableau

Step 1) Click on the “Text File” option given in the data tab.

Connecting to Text File in Tableau

Step 2) In the next screen,

1. Select the SuperStore.csv

2. Click on “Open” Option. This will connect the text file into Tableau.

Connecting to Text File in Tableau

In the left pane you will see the CSV file.

Connecting to Text File in Tableau

Connecting to Excel File in Tableau

Step 1) Click on the “Microsoft Excel” option given in the data tab.

Connecting to Excel File in Tableau

Step 2) In the next screen,

  1. Select the SuperStore.xlsx
  2. Click on “Open” Option.

Connecting to Excel File in Tableau

Step 3) It connects the excel file into Tableau. The sheets present in the excel file is shown on the left side of the window.

Connecting to Excel File in Tableau

Connection to Database

Step 1) Click on the required database connection given in the data tab. For example, if you want to connect to MySQL database, click on the “MySQL” Option.

Connection to Database

Step 2) This will open MySQL connection window.

  1. You can enter the MySQL server name and edit the “Port” if needed.
  2. Enter the username and password used to connect the database.
  3. Click on the “Sign in” button to connect to the database.

Connection to Database

This connects the database into Tableau. You can select tables from the database, import them, and join multiple tables by creating a relationship between them.

Connection to Websites

Tableau can connect to websites using Tableau data connectors. The connection procedure is given as follows.

Step 1) In this window,

  1. Click on “More” option in the data tab.
  2. Select “Web Data Connector” from the list.

Connection to Websites

Step 2) This will open a Tableau Web Data Connector window where you need to enter the web connector details.

Connection to Websites

How to Connect Tableau Desktop to Tableau Server

Tableau Server can store extracted data sources and data connections. At enterprise level it is important to keep the required connections in Tableau Server, so every user can reach the data source easily. Data sets on the server connect to Tableau Desktop as follows.

Step 1) Choose Tableau Server from options

Select the “Tableau Server” option given in the data tab.

Connect Tableau Desktop to Tableau Server

Step 2) Open the Tableau server

This opens the Tableau Server Sign in window. Click on the “Tableau Cloud” option, labelled “Tableau Online” in builds before the 2022 rename.

Connect Tableau Desktop to Tableau Server

Step 3) Sign in

It opens the Tableau Cloud Sign In Window.

  1. Enter the registered email id and password.
  2. Click on ‘Sign In’ button.

Connect Tableau Desktop to Tableau Server

Step 4) Establish a connection

This will connect Tableau Server into Tableau Desktop.

  1. Select the data set as shown in the figure.
  2. This will import the dataset into Tableau.

Connect Tableau Desktop to Tableau Server

The next task is usually combining more than one table.

Data Relationship

A relational Database/Excel file consists of multiple Tables/sheets. These multiple tables/sheets can be connected to each other in Tableau. This connection is established by ‘Join’ or ‘Union’ feature present in Tableau. The relationship between data in two or more tables needs to be specified while joining tables.

Joins

Tableau can “join” tables, up to 32 in a single data source. While joining, the relationship between two or more tables can be specified using an inner join, left join, right join or outer join. The functionalities of each join type are explained in the table below,

Inner Join Left Join Right Join Outer Join
It joins all the common records between two tables or sheets. The joining condition can be given based on the primary key. One or more joining conditions can be specified to join the tables. Many tables can be joined together in Tableau for visualization. A left join is used to join all the records from a left table and common records from the right table. One or more join conditions can be specified to left join two different tables. A right join is used to join all the records from a right table and common records from left table. Based on the requirements, one or more joining condition can be set. An Outer join is used to join all the records from both left and right table. Joining conditions can be set to join common records.

Let’s see an example of Join

Step 1) Once an Excel is connected, Drag the required sheet into data window as shown in the figure.

Data Relationship

Step 2) You can connect multiple sheets by dragging the sheets into the data window. The relationship between the sheets can be given by connecting the data fields.

Data Relationship

Step 3) In the data sheet

  1. Click on the “Join” option as shown in the figure. By default, Tableau joins two tables by connecting a relationship between common column present in it.
  2. You can edit the relationship by selecting the required joining Condition.
  3. You can add one or more data relationship between the sheets or tables.

Data Relationship

Union

Union is used to append the data from two or more tables. In most cases, tables with the same headers are appended together using the union function, and no joining condition is required. The procedure is given as follows.

Step 1) Drag any of the sheet into data window as shown in the figure.

Union

Step 2) Right click on the sheet and select “Convert to Union” option.

Union

Step 3) In the data union window.

  1. Drag other sheets which need to be union.
  2. Click on ‘OK’ to append or union all the sheets present in the window.

Union

A data relationship is not needed to union sheets present in the data source.

Relationships vs Joins in Tableau

Since version 2020.2 the canvas has an upper layer linking tables with a flexible line instead of a fixed join. That line is a relationship, and the choice changes the numbers a view returns.

A join runs immediately and produces one flattened table, so rows duplicate when one side has several matches. A relationship runs nothing until a worksheet requests fields, then queries at the right level of detail.

  • Use a relationship when tables sit at different granularity, such as orders and returns, where duplicated measures would inflate totals.
  • Use a join when a single flat table is genuinely wanted, such as a lookup adding descriptive columns.
  • Use a union when tables share the same columns and only need stacking.

Joins remain available inside each logical table: double-clicking a table opens the physical layer containing the join dialog shown above.

Data Sorting

Data present in the data source can be sorted based on the user requirement. It can be sorted using data source order, ascending, descending, ascending per table and descending per table.

Once the data is connected to Tableau, data sorting can be done using the “Sort Fields” option in the “Data Source” tab. Worksheet-level sorting differs and is covered in sorting data in Tableau.

Data Sorting

Replacing Data Source

Tableau can connect multiple data sources in a single workbook, and those sources can be used to build various sheets and dashboards. In some cases, a data source needs to be replaced with an updated file. Tableau has a replacing feature for this, and it does not affect visualizations already built on the old source. It is important to keep or replace all the used dimensions and measures while replacing the data source.

The procedure for replacing a data source is given as follows.

Step 1) Connect the new data source first, so both the current source and its replacement appear in the Data pane.

Replacing Data Source

Step 2)

  1. Select the Data Source to be replaced.
  2. Right-click on the data source and select “Replace Data Source” option.

Replacing Data Source

Step 3) It opens the data source replacement window.

1. Select the current data source.

2. Select replacement data source.

3. Click on “OK” to replace the data source.

Replacing Data Source

Building views from this data is covered in the Tableau charts and graphs tutorial.

FAQs

A join combines tables inside one data source. Blending keeps two separate sources and merges aggregated results at sheet level, which is the option when sources cannot be joined directly.

Credentials are held separately from the workbook. On publishing, you choose whether viewers supply their own credentials or an embedded account serves everyone.

A join duplicates rows when one key matches several rows opposite, so measures count more than once. A relationship keeps each table at its own granularity and avoids the inflation.

Tableau proposes matching fields by comparing names and data types, and AI assistants explain likely keys. The suggestion still needs checking, because similar names do not guarantee the same meaning.

Tableau Prep Builder recommends splits, groupings, and value standardisation as a flow is built. These speed up cleaning, but each step needs review before the flow is scheduled.

Summarize this post with: