Data Visualisation With Tableau
Data Visualisation With Tableau
Data Visualisation With Tableau
Tableau
In this course, you will learn how to analyse and
display data using Tableau and make better, more
data-driven decisions.
Our goal as Data Analysts is to arrange the insights of our data in
such a way that everybody who sees them is able to understand
their implications and how to act on them clearly.
1. Introduction to Tableau
o Overview
o Installation
2. Getting Started
o Tableau Workspace
o Creating a view
o Key Findings
4. Map View
o Building a Map View
5. Dashboard
o Creating a dashboard
o Adding Interactiveness
6. Story
o Building a Story
o Making a Conclusion
1.Introduction to Tableau
Overview
In this tutorial, we will be working with Tableau Desktop. The link for
the source of reference is here.
Installation
Depending upon the choice of product, download the software on to the computer.
After accepting the license agreement, you can verify the installation by clicking the
Tableau Icon. If the following screen appears, you are good to go.
2. Getting Started
In this section, we will learn some basic operations in Tableau to get accustomed to its
interface.
Tableau Workspace
The Tableau workspace is a collection of worksheets, menu bar, toolbar, marks card,
shelves and a lot of other elements about which we will learn in sections to come.
Sheets can be worksheets, dashboards, or stories. The image below highlights the
major components of the workspace. However, more familiarity will be achieved once
we work with actual data.
s
ource:Tableau.com
To begin working with Tableau, we need to connect Tableau to the data source.
Tableau is compatible with a lot of data sources. The data sources supported by
Tableau appear on the left side of the opening screen. Some commonly used data
sources are excel, text file, relational database or even on a server. One can also
connect to a cloud database source such as Google Analytics, Amazon Redshift, etc.
The launch screen of Tableau Desktop shows the available data sources that one can
connect too. It is also dependent on the version of Tableau since the paid version
offers more possibilities. On the left side of the screen, there is a Connect pane which
highlights the available sources. File types are listed first, followed by common server
types, or the servers that have been recently connected. You can open previously
created workbooks Under Open tab. Tableau Desktop also provides some sample
workbooks under Sample Workbooks.
Hands On
We shall be working with a sample data set names Superstore dataset, that comes
pre-loaded with Tableau. However, we will be downloading the file from here so that
we can get an idea of connecting to an Excel data source. The data is that of a
superstore. It contains information about products, sales, profits, etc. Our aim as Data
Analysts is to analyze the data and find critical areas of improvement within this
fictitious company.
Steps
Creating a View
We will start by generating a simple chart. In this section, we will get to know our data
and will begin to ask questions about the data to gain insights. There are some
important terms that we will encounter in this section.
Dimension
Measures
Aggregation
Measures are quantitative numerical data. By default, Tableau treats any field
containing this kind of data as a measure, for example, sales transactions or profit.
Data that is classified as a measure can be aggregated based on a given dimension,
for example, total sales (Measure) by region (Dimension).
Aggregation is the row-level data rolled up to a higher category, such as the sum of
sales or total profit.
Tableau automatically sorts the fields in Measures and Dimensions. However, for any
anomaly, one can change it manually too.
Steps
Tableau populates a chart with sales aggregated as a sum. Total aggregated sales for
each year by order date is displayed. Tableau always populates a line chart for a view
that includes time-field which in this example is Order Date.
Hands On
What does the line chart above convey? Well, it shows that the sales look
quite promising and appear to be increasing with time. This is a valuable
insight, but it hardly says much about the products which are contributing
to increased Sales. Let us delve further to get more insights.
Let us delve deeper and try to find out more insights regarding which products drive
more sales. Let's start by adding the product categories to look at sales totals in a
different way.
Steps
1.
To add labels to the view, click Show Mark Labels on the toolbar.
The sub-category is another discrete field. It further dissects the Category and displays
a bar for every sub-category broken down by category and year. However, it is a
humongous amount of data to make sense of visually. In the next section, we will
learn about filters, color and other ways to make the view more comprehensible.
Hands On
Filters can be used to include or exclude values in the view. Here we try to add two
simple filters to the worksheet to make it easier to look at product sales by sub-
category for a specific year.
Steps
In the Data pane, under Dimensions, right-click Order Date and select Show
Filter.Repeat for Sub->category field also.
Filters are the type of cards and can be moved around on the worksheet by
simple drag and drop
Adding colors to the view
Steps
In the Data pane, under Measures, drag Profit to Color on the Marks card.
It can be seen that Bookcases, Tables and even machine contribute to negative profit, i.e., loss. A powerful insight.
Hands On
Key Findings
Let's take a closer look at the filters to find out more about the unprofitable products.
Steps
In the view, in the Sub-Category filter card, uncheck all boxes except Bookcases, Tables, and Machines. This brings to
light an interesting fact. While in some years, Bookcases and Machines were actually profitable. However, in 2016,
Machines became unprofitable.
Select All in the Sub-Category filter card to show all the subcategories again.
From the Dimensions, drag Region to the Rows shelf and place it to the left of the Sum(Sales) tab. We notice that
machines in the South are reporting a higher negative profit overall than in your other regions.
Let us now give a name to the sheet. At the bottom-left of the workspace, double-click Sheet 1 and type Sales by
Product and Region.
In order to preserve the view, Tableau allows us to duplicate our worksheet so that we can continue in another sheet
from where we left off.
In your workbook, right-click the Sales by Product and Region sheet and select Duplicate and rename the duplicated
sheet to Sales-South.
In the new worksheet, from Dimensions, drag Region to the Filters shelf to add it as a filter in the view.
In the Filter Region dialogue box, clear all check boxes except South and then click OK. Now we can focus on sales
and profit in the South. We find that machine sales had a negative profit in 2014 and again in 2016. We will
investigate this in the next section
Lastly, do not forget to save the results by selecting File > Save As. Let us name our workbook as Regional Sales and
Profits
4. Map View
Creating a Map View
Map views are beneficial when we are looking at geographic data (the Region field). In the current
example, Tableau automatically recognizes that the Country, State, City, and Postal Code fields contain
geographical information.
Steps
Add State and Country under Data pane to Detail on the Marks card. We obtain the map view.
Drag Region to the Filters shelf, and then filter down to South only. The map view now zooms in to the
South region only, and a mark represents each state.
Drag the Sales measure to the Color tab on the Marks card. We obtain a filled map with the colors showing
the range of sales in each state.
We can change the color scheme by clicking Color on the Marks card and selecting Edit Colors. We can
experiment with the available palettes.
We observe that Florida is performing the best regarding Sales. If we Hover over Florida, it shows a total of
89,474 USD in sales, as compared to South Carolina, for example, which has only 8,482 USD in sales. Let us
gauge the performance by Profit now since Profit is a better indicator than Sales alone.
Drag Profit to Color on the Marks card. We now see that Tennessee, North Carolina, and Florida have
negative profit, even though it appeared they were doing good in Sales. Rename the sheet as Profit Map
Hands On
Maps empower us to visualize the data broadly. In the last step, we discovered that we discovered that Tennessee,
North Carolina, and Florida have a negative profit. In this section let us draw a Bar chart to explore the reason for the
negative profit.
Steps
Duplicate the Profit Map worksheet and name it Negative Profit Bar Chart.
Click Show Me on the Negative Profit Bar Chart worksheet. Show Me presents the number of ways in which a graph
can be plotted between items mentioned in the worksheet. From Show Me select the horizontal bar option and the
view updates to horizontal from vertical bars instantly.
We can select more than one bar at a time by simply clicking and dragging the cursor over them. We want to focus
only on the three states, i.e., Tennessee, North Carolina, and Florida. Hence, we will only select the bars pertaining
to them.
Learn More
Creating Hierarchies:
Hierarchies come in handy when we want to group similar fields so that we can quickly drill down between levels in
the viz.
In the Data pane, drag a field and drop it directly on top of another field or right-click the field and select
Drag any additional fields into the hierarchy. Fields can also be re-ordered in the hierarchy by simply dragging them
to a new position. In the current viz. we will create the following hierarchies: Location, Order, and Product.
On the Rows Shelf, click the plus-shaped icon on the State Field to drill-down to the City level.
That's a lot of data. We can use N-Filter to filter and reveal the weakest performers. For that, drag City from the Data
pane to the Filters shelf. Click By field and then Click the Top drop-down and select Bottom to reveal the weakest
performers. Type 5 in the text box to show the bottom 5 performers in the data set.
We now see that Jacksonville and Miami, Florida; Burlington, North Carolina; and Knoxville and Memphis, Tennessee
are the poorest performing cities by profit. There is one other mark in the view—Jacksonville, North Carolina—that
doesn't belong here since it has profitable sales. This means there is an issue in the filter we applied. We will take the
help of Tableau Order of Operations.
On the Filters shelf, right-click the Inclusions (Country, State) set and select Add to Context. We find that now
Concord(North Carolina) appears in view while Miami(Florida) have disappeared. This makes sense now.
But Jacksonville (North Carolina) is still present which is incorrect. On the Rows shelf, click the plus-shaped icon on
City tab to drill down to the Postal Code level. Right-click the postal code for Jacksonville, NC, 28540, and then select
Exclude to exclude Jacksonville manually.
Drag Postal Code of the Rows shelf. This is the final view.
Hands On
Key Findings
Let us now focus only on the loss-making entities, i.e., the Products and also let us identify the locations where such
products are sold.
Steps
Similarly, drag the Profit to Color on the Marks card. This enables us to spot products with negative profit quickly.
Right-click the Order Date and select Show Filter. It seems that Machines, tables, and binders are performing poorly.
So what should we do? One solution would be to stop the sale of these products in Jacksonville, Concord, Burlington,
Knoxville, and Memphis? Let's verify if our decision is right.
Now, click on the Sub-Category field to select the Show Filter option.
Drag Profit from under Measures onto the Label Marks card.
Again, click on the Order Date and select Show Filter. From the filter let us clear off the items which we think are
contributing to negative profit. So, uncheck the boxes in front of Binders, Machines, and Tables respectively. Now we
are only left with the profit-making entities. This shows that the entities like Binders, machines, and tables were
actually causing losses in some areas and we were right in our findings.
5. Dashboard
A dashboard is a collection of several views, enabling one to compare a variety of data simultaneously.
Creating a Dashboard
Steps
Drag Profit Map to the dashboard, and drop it on top of the Sales in the South view. Both views can be seen at once.
To be able to present data in a manner so that others can understand it we can arrange the dashboard to our liking.
On the Sales South worksheet in the dashboard view, click under the Region and clear off the Show Header. Repeat
the same process for all the other headers. This helps to emphasize only what is needed and hides away the not so
important information.
On the Profit Map, Hide the Title as well and perform the same Steps for the Sales South map.
We can see that the Sub-Category filter card and Year of Order Date have been repeated on the right-side. Let us get
rid of the extra by simply crossing them out. Finally, click on the Year of Order Date. A drop-down arrow appears and
select the option of Single Value (Slider). Now let the magic unfold. Experiment by choosing different years on the
slider and the Sales also vary accordingly.
Drag the SUM(Profit) filter to the bottom of the dashboard below Sales in South for a better view.
Hands On
Adding Interactiveness
In order to make the dashboard more interactive like viewing which sub-categories are profitable in which states, a
few changes need to be done.
Steps
Let's start with the Profit Map. On clicking the map, a Use as filter icon appears in the upper right. Click on it. If we
select any map, Sales corresponding to that state will be highlighted in the Sales-South map.
For the Year of Order Date, click on the drop-down option and go to Apply to Worksheets > Selected Worksheets. A
dialog box opens up. Select the All option followed by OK. What does this option do? It applies filters to all the
worksheets having the same data source.
Explore and experiment. In the visualization below, we can filter the Sales South map to view products that are being
sold in North Carolina only. We can then easily explore the profits yearly.
Hands On
Thus, selling machines in the North Carolina did not bring any profits to the company.
6. Story
A dashboard is a cool feature, but tableau also offers us to showcase our results in presentation mode in the form of
stories about which we will discuss in this section.
Building a Story
Steps
From the Story pane on the left, drag the Sales in the South worksheet (created earlier) onto the view.
Edit the text in the gray box above the worksheet. This is the caption. Name it as Sales and profit by year.
Stories are quite specific. Here we will tell a story about selling machines in North Carolina. In the Story pane, click on
Duplicate to duplicate the first caption, or you may even create a new one.
In the Sub-Category, filter select only Machines. This helps to gauge sales and profit of machines by year.
Hands On
Making a Conclusion
It is clear that machines in North Carolina are leading to loss of profit. However, this cannot be demonstrated by
looking at Profit and Sales on the whole. For this, we need regional Profit.
Steps
In the Story pane, select Blank. Drag the already created dashboard Regional Sales and Profit onto the canvas.
Select Duplicate to create another story point with the Regional Profit dashboard. Select North Carolina on the bar
chart since we are interested in showing more about it.
Select All the years.
Select any year like 2014. Add a caption, for example, Profit in NC : 2014 and then click on the Duplicate tab. Repeat
the same step for all the remaining years.
Hands On
Now we have an idea about, what products were introduced to the North Carolina market when, and how they
performed. Not only have we identified a way to address negative profit, but have also successfully managed to back
it with data. This is the advantage of Story in Tableau.