You are on page 1of 12

Introduction to Tableau

Modern conception of Data Science is the art and science of solving real world problems and for making data
driven decisions. To begin with, it involves an amalgamation of three aspects. These aspects are:

1. Basic proficiency in understanding the data


2. Basic idea of the tools & technology (Tableau)
3. Domain knowledge.

With the basic understanding of those three aspects, you can begin the journey of understanding Data
Science. With consistent effort, you can become fairly proficient in all three aspects over a period of time.
The document is intended to help you become comfortable with the finer nuances of Tableau (as a
platform for working on data).

What is Tableau?

Tableau is a platform for discovering, preparing, visualizing, and sharing data. It’s highly scalable and is
used by data science teams across all vertical markets.

Tableau currently offers four main products:


• Tableau Desktop — “fast analytics for everyone” — allows you to explore and visualize data in
minutes, connecting to data and performing queries without ever writing a line of code
• Tableau Server — “collaboration for any organization” — allows users throughout an
organization to access live interactive dashboards in a web browser or on a mobile device
• Tableau Online — “business intelligence in the cloud” — is a hosted version of Tableau Server
that requires no set-up
• Tableau Public — “for public data” — lets you read files saved in Tableau Desktop

Tableau Public is a free platform to explore, create, and publicly share data visualizations online.
Visualizations that have been published to Tableau Public (“vizzes”) can be embedded into web
pages and blogs, they can be shared via social media or email, and they can be made available
for download and exploration by other users. Visualizations are created in a browser by clicking
“Create a Viz” on your profile page. You can also create vizzes and publish to Tableau Public from
Tableau Desktop Professional or Public Edition –no programming skills are required

The company also offers add-ons (e.g., Tableau Data Management and Server Management), embedded
analytics, and developer tools like webhooks for advanced integrations, customizations, and automation.

Get Started Using Tableau


Getting started with Tableau is not as hard as it might sound—even for beginners. The platform offers a
robust learning community with free training videos, live training sessions, and certification programs.

As a more broad benefit, Tableau can be quite quick and simple to use. If you have a CSV file ready, you can
create a dashboard in minutes. This dashboard will include several sheets of different visualizations whether
that be a map, chart, or table (etc.). You can essentially drag and drop fields into your sheet and select
visualization.

Tableau: [https://www.tableau.com]

Connect to and Prepare Data


Before you begin your analysis, you must connect to your data and then set up the data source. There are
many optional configurations that you can make on the Data Source page that Tableau uses to interpret and
interact with your data.
Connect to Your Data
When you launch Tableau Desktop, the data connectors that are available to you are listed on the Connect
pane, which is the left pane on the Start page.

How to connect to your specific data?

Excel File
Tableau connects to .xls and .xlsx files. To connect to a .csv file, use the Text file connector.

Make the connection and set up the data source. After you open Tableau, under Connect, click Excel. Select
the Excel workbook you want to connect to, and then click Open.

On the Data Source page, do the following:

• (Optional) Select the default data source name at the top of the page, and then enter a unique data
source name for use in Tableau. For example, use a data source naming convention that helps
other users of the data source figure out which data source to connect to.

• If your Excel file has one table, click the sheet tab to start your analysis.

Use custom SQL to connect to a specific query rather than the entire data source.
You can also connect to a named range or an Excel table (also known as an Excel list) in the same
way you connect to a worksheet. Both the named range and Excel table function as a table in
Tableau.
You create named ranges in Excel by selecting a range of cells and then selecting Define Name on
the Formulas tab. Similar to named ranges, you can create an Excel table in Excel by selecting a
range of cells, and then selecting Insert > Table. When you connect to a named range or Excel table
in Tableau, an icon appears next to the sheet in the Data Source page as shown below.

You can connect to multiple Excel workbooks at the same time as long as each connection in the data
source has a unique name.

Build a Bar Chart

Use bar charts to compare data across categories. You create a bar chart by placing a dimension on the
Rows shelf and a measure on the Columns shelf, or vice versa.

A bar chart uses the Bar mark type. Tableau selects this mark type when the data view matches one of
the two field arrangements shown below. You can add additional fields to these shelves.

Creates Vertical Bars


Creates Horizontal Bars

To create a bar chart that displays total sales over a four-year period, follow these steps:

How to Build a Bar Chart?

Step 1:

Connect to the Sample - Superstore data source

Step 2:

Drag the Order Date dimension to Columns and drag the Sales measure to Rows.

Notice that the data is aggregated by year and column headers appear. The Sales measure is aggregated as a
sum and an axis is created, while the column headers move to the bottom of the view. Tableau uses Line as
the mark type because you added the date dimension.
Step 3:

On the Marks card, select Bar from the drop-down list.

The view changes to a bar chart.


The marks (which are bars in this case) are vertical because the axis is vertical. The length of each mark
represents the sum of the sales for that year. The actual numbers you see here might not match the numbers
you see—the sample data changes from time to time.

Step 4:

Drag the Ship Mode dimension to Color on the Marks card.

The view shows how different shipping modes have contributed to total sales over time. The ratios look
consistent from year to year.
Step 5:

Drag the Region dimension to Rows, and drop it to the left of Sales to produce multiple axes for sales by
region.

Step 6:

To view data in the West region only, you can filter out the other regions. To do this, drag the Region
dimension again, this time from the Data pane to the Filters shelf.
Step 7:

In the Filter [Region] dialog box, clear the Central, East, and South check boxes, and then click OK

This view gives you insight into your data—for example, how the ship mode changed in the West over the
four-year period.

Analyze Data
How to create and use calculated fields in Tableau using an example?

Calculated fields allow you to create new data from data that already exists in your data source. When you
create a calculated field, you are essentially creating a new field (or column) in your data source, the values or
members of which are determined by a calculation that you control. This new calculated field is saved to your
data source in Tableau, and can be used to create more robust visualizations. But don't worry: your original
data remains untouched.

You can use calculated fields for many, many reasons. Some examples might include:

• To segment data
• To convert the data type of a field, such as converting a string to a date.
• To aggregate data
• To filter results
• To calculate ratios

Types of calculations

You create calculated fields using calculations. There are three main types of calculations you can use to create
calculated fields in Tableau:

• Basic calculations - Basic calculations allow you to transform values or members at the data source
level of detail (a row-level calculation) or at the visualization level of detail (an aggregate calculation)
• Level of Detail (LOD) expressions - Just like basic calculations, LOD calculations allow you to compute
values at the data source level and the visualization level. However, LOD calculations give you even
more control on the level of granularity you want to compute. They can be performed at a more
granular level (INCLUDE), a less granular level (EXCLUDE), or an entirely independent level (FIXED)
with respect to the granularity of the visualization
• Table calculations - Table calculations allow you to transform values at the level of detail of the
visualization only

Create a calculated field

1. In Tableau, select Analysis > Create Calculated Field.

2. In the Calculation Editor that opens, do the following:

• Enter a name for the calculated field. In this example, the field is called, Discount Ratio.

• Enter a formula. This example uses the following formula:


IIF([Sales] !=0, [Discount]/[Sales],0)
This formula checks if sales is not equal to zero. If true, it returns the discount ratio (Discount/Sales); if false, it
returns zero.

To see a list of available functions, click the triangle icon on the right-side of the Calculation Editor.

Each function includes syntax, a description, and an example for your reference.

Double-click a function in the list to add it to the formula.


3. When finished, click OK.
The new calculated field is added to Measures in the Data pane because it returns a number. An equal
sign (=) appears next to the data type icon. All calculated fields have equal signs (=) next to them in
the Data pane.

Use a calculated field in the view

Step 1: Build the view

1. From Dimensions, drag Region to the Columns shelf.

2. From Dimensions, drag Category to the Rows shelf.

3. On the Rows shelf, click the plus icon (+) on the Category field to drill-down to Subcategory.

The view updates to look like this:

Step 2: Add the calculated field to the view


1. From Measures, drag Discount Ratio to Color on the Marks card.

The view updates to highlight table.

You can see that Binders are heavily discounted in the Central region. Notice that Discount Ratio is
automatically aggregated as a sum.

2. On the Rows shelf, right-click SUM(Discount Ratio) and select Measure (Sum) > Average.

The view updates with the average of discount ratio shown.

Edit a Calculated Field


If at any time you need to change a calculation, you can edit the calculated field and it will update
across your entire workbook. To edit a calculated field:
1. In the Data pane, right-click the calculated field and select Edit.

2. In the Calculation Editor that opens, you can do the following:

• Edit the name of the calculated field.

• Update the formula.

For this example, the formula is changed to return a discount ratio for orders over 2000 USD
in sales:
IIF([Sales] > 2000, [Discount]/[Sales],0)

3. Click OK
The view updates to reflect the changes automatically. You do not need to re-add the updated
calculated field to the view.

Save Your Work in Tableau-Public


You can save your workbook to Tableau Public, a free cloud service. On Tableau Public, anyone can
interact with your views, or download your workbooks or data sources. To save a Tableau workbook:

1. With your workbook open in Tableau Desktop, select Server > Tableau Public > Save to Tableau Public

2. Sign in using your Tableau Public account


If you don’t have an account, select the link to create a new one.

3. Type a name for the workbook and click Save.


When you save a workbook to Tableau Public, the publishing process creates an extract of the data
connection.

After the workbook is published, you are redirected to your account on the Tableau Public website

On your profile page on Tableau Public, do any of the following to customize your profile:

Hover the pointer over a viz to get access to actions such as selecting it as your featured viz, or hiding,
downloading, or deleting it.

Hover the pointer over a viz and then select View to open the viz’s home page. There you can select
Edit Details to customize metadata such as workbook name and description, add a permalink, and
change other settings.

To get a link to share on social media or code to embed in a web page, display a view, and then click
Share at the bottom of the view. (You can get links and embed code for other Tableau Public users’
views this way, too.)

You might also like