You are on page 1of 17

Learn everything about the Data Sources

Tableau Start Page

1. Connect to a File: This section helps you to connect with Files, or allows you to extract data from files
such as Excel, Text Files, PDFs, Spatial Files etc.
2. Connect To a Server: This section helps you to connect with the Servers, or allows you to extract data
from servers such as MySQL, SQL Server, Tableau Server etc.
3. Saved Data Sources: All the existing or Saved Data Sources will be displayed under this section.
4. Open: Most recently used Workbooks will be displayed under this section. Currently, we don’t have any
used workbooks.
5. Sample Workbooks: These are sample workbooks that will come with Tableau Desktop installation.
6. Training and Resources: Links to Useful Blogs and some videos.
7. Content produced by the tableau Community

Selecting the Data Source will open a New Sheet to create a Report. Here, you can see
the Measures, and Dimensions that are available in this data source.
Tableau Show Me
Show Me window holds most commonly used charts in Tableau. You can use any of these
charts to view the data.

Text Label Heat Map Highlight Table


Symbol Maps Maps Pie Chart
Horizontal Bars Stacked Bars Side-By-Side Bars
Treemap Circle Views Side-By-Side Circle Views
Line Chart Discrete Lines Dual Lines
Area Chart Discrete Area Chart Dual Combination Chart
Scatter Plot Histograms Box and Whisker Plots
Gantt Chart Bullet Graph Packed Bubbles Chart
Connecting to Excel Files in Tableau
1. Workbook: Excel File we selected from our file system.
2. Sheets: This section will display the Sheets or Tables present in the Excel source.
We have two tables so, it is displaying those two sheets (Customers and
Department). We have the search bar under this section and it is very useful for a
large number of sheets. For instance, If you have 30 or 40 sheets then you can use
this to search for a specific table
3. Drag Sheets Here: You have to Drag Table(s) from Sheets to this Section. Tableau
will only use the tables present in this area. This is something like Dataset.
4. This region will show the data present in our Dataset

1
3

5. Data Interpreter: If Tableau discovers the format of any column data in our selected
sheet is difficult to analyze, Tableau will pop up a message asking us to Turn On Data
Interpreter. By turning Data Interpreter on, we can normalize the data
Connecting to Text File in Tableau

Once you click on Info button, a new drop-down window will open to configure the
following items:

 Does the file includes field names in the First Row?: We have to specify,
whether the selected text file contains column names in the first row or not. By
default, this option is selected as YES but change as per your file requirements.
 Filed Separator: Please select the character that is used to separate the columns
in the text file. If the character is not present in the list, select Other and type a
custom character.
 Text Qualifier: Please specify the text qualifier used to encloses values in our
selected Text File.
 Character Set: Please select the character set that describes the text file encoding.
 Locale: Language used to parse the Text File. Tableau will use this to separate the
numbers etc
Connecting Tableau to SQL Server

 Server: Please specify the SQL Server instance name


 Enter information to sign into the server: Decide how you want to connect with
SQL Server
 Require SSL: Please check mark this option while connecting to SQL Server. This
will prevent SQL Injections.
 Read Uncommitted data: Please check mark this option to use the Read
Uncommitted ACID property.

 AdventureWorksDW2014 is the default data source name (In fact, selected


Database name) assigned by the Tableau. Please change this default name to a
more meaningful unique name as per your requirements
 Server: Display the Instance name we used to connect with the SQL Server.
 Database: This section will display the Database we selected.
 Table: This section will display the available Tables, Views and Stored Procedures
in the selected Database. We have the search bar under this section.
 Drag Sheets Here: You have to Drag Table(s) from Table to this Section.
 If you click Update Now, We have to click this button every time we made changes
to the Dataset
 If you click Automatically Update button, changes made to the Dataset will
automatically reflect the preview. In this example, we are selecting this option
You can write your own SQL Query to extract data from the selected Database or data
source using New Custom SQL.
SELECT Geo.EnglishCountryRegionName AS Country,
Geo.StateProvinceName AS State,
SUM(Fact.SalesAmount) AS Sales,
SUM(Fact.TaxAmt) AS Tax,
COUNT(Fact.OrderQuantity) AS Orders
FROM FactResellerSales AS Fact
INNER JOIN
DimSalesTerritory ON
Fact.SalesTerritoryKey = DimSalesTerritory.SalesTerritoryKey
INNER JOIN
DimGeography AS Geo ON
DimSalesTerritory.SalesTerritoryKey = Geo.SalesTerritoryKey
GROUP BY Geo.EnglishCountryRegionName, Geo.StateProvinceName
HAVING COUNT(Fact.OrderQuantity) > 60000
Hierarchies in Tableau
Tableau Hierarchy provides drill-down action to the report. With the help of tiny + and –
symbols, we can navigate from a higher level to nested level or lower level.
Approach 1 to Create hierarchies, Select and Right Click on the Dimension name, on
which you want to create a hierarchy in Tableau. Please select the hierarchy option and
then select create hierarchy option from the context menu.

There are multiple ways to add members to hierarchies in tableau.


The first method, Drag and drop the required dimension to the newly created hierarchy in
Tableau.
The second method, Select and Right Click on the Dimension name, which you want to
add to existing hierarchy in Tableau. Please select the hierarchy option then Add to
hierarchy option and then select the hierarchy name from the context menu
Country  State  City  Postal Code
When you expand the Country Region name, Tableau report will display Sum of Sales
amount for every state present in the countries.

Approach 2 to Create hierarchies in Tableau


Drag one member on to the other will automatically create hierarchies in tableau.

select and Right Click on the Hierarchy member, select the hierarchy option and
then Remove from hierarchy option from the context menu

Tableau Bins
Tableau Bins are useful to create a Range of data, which is similar to SQL Buckets

To create bins in tableau, we are going to write the Custom SQL Query against the SQL
Server Data Source
SELECT Prod.Productkey,
Prod.EnglishProductName,
Prod.Color,
Prod.DealerPrice,
Fact.OrderQuantity,
Fact.TotalProductCost,
Fact.SalesAmount
FROM DimProduct AS Prod
INNER JOIN FactInternetSales AS Fact
ON Prod.ProductKey = Fact.ProductKey
Drag and Drop the Sales Amount from Measures Region to Filed region.
Right-click on the Product Key dimension and select Create option and then
select Bins option from the context menu.
If you don’t know the bin size then click on the Load button. By clicking this button, the
Tableau desktop will display the Minimum, Maximum, Difference values and also the best
possible Bin size.
Please replace Product Key dimension with Product Key Bin on Row Shelf.

You can observe that Product Key Data is organized into Buckets and the total rows are
21 only.

To display the product keys available in each bin, Drag and Drop the Product key
dimension to the Row Shelf
Select the Bin you want to delete and right-click on it will open the context menu. From the
context menu, Please select the Delete Option.

Create Stacked Bar Chart using Tableau Bins


Tableau allows us to create Bins on both Dimensions and Measures. In this example we
will create Tableau Bins on Measure value and using that Bin value, We will create
Stacked Bar Charts.

Default Bar Chart with Color dimension on Row Shelf and Sales Amount on Column Shelf

Right Click on the Sales Amount Measure and select Create Bins option from the menu.
Now, we are using the default bin size generated by the Tableau Desktop
Next, Drag and Drop the newly created Sales Amount bin from Dimension region to
the Color Option in Marks Card. Once you are done, You can see the Stacked Bar Chart.
Let us add the Data Labels and see, whether we successfully created the stacked bar
charts using the Tableau Bins or not
How to Join Data in Tableau
1) Inner join
2) Left Join
3) Right Join
4) Full outer join
NOTE: Using this Join in Tableau method, you can join more than two tables. Please be
careful with complex joins, it will be difficult to understand the data.

Tableau Data Blending


Data Blending in Tableau is very useful to join two data sources (or different data sources)

For this Tableau data blending demo, we are going to use the data present in Excel
Worksheet and SQL Server.

Tableau Data Blending Approach 1


First, we connected to Employees.xlsx workbook and added the Employee List sheet to
the data region.

Our requirement is to create table report with employee first name, last name, occupation,
Sales and yearly income. 
Scenario: Suddenly, Client changed the requirements and asked us to add department
and Salary Hike percentage details for every Employee. Here the real problem is,
department and Salary Hike percentage data are present in the Master SQL Server
database. It means, we have to combine few columns from Local Excel Sheet and few
from SQL Database. This is what we call as Tableau Data Blending

Please navigate to Data menu and select New Data Source option from Menu.

Let us add the Department name to the Rows Card. From the below screenshot you can
observe that Tableau is displaying little orange tick mark at department name and also
displaying the warning message.

If you read the warning message, it is a pretty straightforward message saying that there
is no relation between Employees and department. Relationship is very important in
Tableau data blending so, please add the relation.

In order to add a relationship, Go to data menu and select Edit Relationships..

 Primary Data Source: Data Source from which we first dragged the fields
(Dimension or Measure) into report region is called as a Primary data source.
Tableau will display little Blue tick mark beside this data source
 Secondary Data Source: Data Source which is not primary. Tableau will display
little orange tick mark beside secondary data source
 Automatic: If there are any common Filed names in both the data sources then
tableau will automatically detect the possible relationship between those two fields.
 Custom: If there are no common Filed names in the data sources, We have to
select the Custom option and add the relationship between them. For now, we are
selecting this option

Once you specified the relationship, tiny URL link will appear beside the Id column. Click
the link button to enable Data blending in tableau.

When you click the link button, link button colour will change to Orange colour and Our
Department column is displaying data.

Remember, If there are no matching records in Department then Null values will be
displayed.

Tableau Data Blending Approach 2


Please select and right-click on the Id column will open the context menu. Please select
the Aliases.. option from the context menu .

Once you selected the Aliases.. option, a new window will popped up to rename the filed.
Let us change the Id Column to Dept ID

Tableau will automatically detect the relationship between Dept ID in Employee table and
Dept ID in Department table. It means you don’t have to create a relationship on your own.
You can observe that tiny URL link will appear beside the Dept ID column. Click the link
button to enable Tableau Data Blending

Remove or Edit Relationships in Tableau


Navigate to Data menu and select Edit Relationships.. option from Menu after that new
Relationships window will open. Please select the Relationship you want to remove and
Click Remove button.
Following warning message is displayed because we are using Department Name and
Hike Rate in Tableau report.

Next, One more warning message which we have seen before. Once you click OK button,
Tiny URL link will be removed besides the Id column as shown below.

You might also like