Tableau Tutorial Tutorial

Tableau Data Source Connection


For any reporting tool to create any type of visualization, we required data. To get the data from different types of Data Source, we need to create Data Source connection. Without a valid data source connection, we will not able to fetch data. And without the data, we will not able to create any visualization in reports. In this article, we will learn How to Create our first Data Source connection. We will use the following text files.

Sample Data Files

Tableau Public Desktop.

Cartoon Characters sample textLogin to Download

If you want to know How to Download and Install Tableau on Windows and or Mac, click on the respective links. 

Create our First Data Source Connection using the Text File

For our first example, we will use “Cartoon Characters.txt” and we will create a new Data Source on Tableau Public Desktop.
Before creating the Data Source connection, using our sample text file, a little information about the data available in our text file. 
The sample text file contains records for the famous cartoon characters in the 1900s. It contains 6 Columns. All the columns of data are separated using the tab delimiter.  
We launched the Tableau desktop and we are on the start page. Following are the steps to create a new Text File Data Source Connection.

  • On the Connection Pane, click on the “Text File” available under "To a File" Section. 
  • Next, we need to provide the text file which we need to use. Select the file and then click on Open.

The following image demonstrates the above steps.

Create a Text File Connection

Once you have selected the Text File Tableau will create a new Data Source connection for you and Display the available table for the connection and data in it. We are using a text file, so we only have one table. Let’s understand the user interface for the Data Source Page.

Data Source User Interface

Data Source User Interface

As shown in the above image on Data Source at the top we have Menu Bar. On the left pane, we have a Data Source Connection name, the list of available tables and filters. In the center, we have our table used for this data source and the Data from the selected tables. On this page, we can perform data cleaning, modification, and calculations. We will learn more about all the Data operations in our future articles. 
In the center the first half we can find all the selected tables from which we need data and the joining condition between the tables. Currently, we are using a text file, so we can only able to add a single table. On the second half, we can check the data for the selected tables.

Above the data we a toolbar. On the toolbar, we have the following options.
Preview Data Source: By default, it is selected. It is used to display data from the selected tables from the data source.
Manage Metadata: The next option is the metadata. Here you can find information about the columns. Such the table, original column name in the table. You can also rename the column if you want.

Manage Metadata

Sort fields: We can use it to sort the columns arrangement.

Sort Fields

Show Alias: It is used to display alias if you define it for some columns. For gender, we changed M into Male and F into Female. If the Show Alias checkbox is checked, then you can see Male and Female instead of M and F in our data output. How we did it? For this right click on the Gender column, then select Aliases…

Show Aliases

Show hidden field: It is used to display the hidden columns. For example, we don’t require the DOB birth column. So, we can hide it. Right click on the column and select hide. But what if you need to unhide then you can check the show hidden field checkbox. It will bring all the hidden fields. As shown in the image the hidden fields are grayed out.

No of Output rows: The last option on the toolbar is to control the number of records you want to display data on the source page. It will not filter out the data. It is used to control How many records you want to display on the data page during your data source creation. Number 2 in the image is only for the explanatory purpose. You can set it to 1000 or 2000 if you have millions or billions of records in our data source. It will help tableau to prevent to bring all the records during your data processing. It is unnecessary to bring all the data only to check the data processing operations.

Number of Rows

We are almost done with the understanding of the Data Source page. To switch back to the Tableau Workbook editing, click on the worksheet name which you want to open. As we mentioned in our User Interface article Tableau start with a blank workbook and with a single worksheet. Let’s open the available worksheet and add some columns to test.

From the sidebar, select the data tab. From the dimensions select the FirstName, LastName, and Gender, then drag and drop it over rows. If required to arrange the columns, change the order. Following is the image for our worksheet output.

Number of Rows

We are done without first Text File Data Source Connection.
Few important things while you are using a text file.
Always provide a valid header for your data. You can create a data source connection without a header. But then you manually need to define the column names.

Use the same set of column delimiters in your entire text file. In the next image, we use both the comma and tab delimited. Either use the comma or use the tab delimiter or any other. Make it consistent.

If the Tableau is not able to recognize the correct properties for your text file connection, you can manually edit it.

This is briefly about our first data source connection. We will learn more about the data source connection in our other articles.
In the next article, we will use an Excel file to create a Data Source Connection. We will also learn How to join data from different tables (Excel worksheet in case of Excel Data Source Connection).

Leave A Comment

Please login to post your valuable comments.