Have a look at the visualisation below, which was created by a famous Swedish statistician, Hans Rosling. He compiled roughly 200 years of World Development Data and presented it in a very simple manner:
This above is an excellent example of Data Visualisation, which rather than focussing on what the numbers are, focuses on telling their story. You can find the interactive version of this visual here.
There are multiple Software that are available now at instant access which assist in such easy visualisations and one tool that we are going to cover in this article is Tableau.
Sample Dashboard in Tableau
What can you make out from the picture below?
This Dashboard, made on Tableau, represents the Sales and Profit Analysis of a Supermarket.
At a glance, you can see:
- The Sales distribution of various categories relative to each other
- Their respective Profit margins.
- Each Category’s Sub – Category Product Sales
- And finally, the Sales growth of the Categories over the years
So, in this article, we will learn how to make such simple visualisations in Tableau to understand our data well.
Table of Contents :
- Overview of Tableau
- Getting Started
- Connect to Data
- Data Visualisations
- Other Functionalities
- Drill Down and Up
- Trend Lines
- Story – Bringing it all together
- End Notes
1. Overview of Tableau
1.1 What is Tableau?
Tableau is a Data Visualisation tool that is widely used for Business Intelligence but is not limited to it. It helps create interactive graphs and charts in the form of dashboards and worksheets to gain business insights. And all of this is made possible with gestures as simple as drag and drop!
What Products does Tableau offer?
1.2 What do you need to know before using Tableau?
You don’t need to know much to use Tableau, but still a basic awareness of all the types of graphs such as bar graph, line charts, histograms etc is preferred.
Along with that it will be beneficial if you possessed some basic understanding of database management ( datatypes, joins, drill down, drill up etc ) too. Even if you don’t, not a reason to worry since I will be covering all such concepts in this and forthcoming articles.
1.3 Installation :
To work on Tableau, you need Tableau right?
Out of the five above mentioned products, Tableau Desktop, Public and Online offer Data Visual Creation.
It is available in the following three formats :
- Free trial for 14 days
- If you are a student or a teacher, you get free access to the Desktop for a full year.
- Purchase Tableau
Tableau Public is purely free of all costs and does not require any licence. But it comes with a limitation that all of your data and workbooks are made public to all Tableau users.
Tableau Online is the best option for you, if you wish to make your Workbooks on the Cloud and be able to access them from anywhere.
2. Getting Started
Now that you have the suitable product installed and set up, I am pretty sure that your hands must be tingling with anticipation to finally begin! Well let’s not keep you waiting then, go ahead and launch the tool.
2.1 Connect to the Data
You should see a screen similar to the one above. This is where you import your data. As is visible, there are multiple formats that your data can be in. It can be in a flat file such as Excel, CSV or you can directly load it from data servers too.
You can see that Tableau itself offers some Sample Workbooks, with pre-drawn charts and graphs. I would suggest going through these later for further exploration.
The best way to learn is to get your hands dirty. Let us start with our Data, which can be found here. The data is that of a United States’ Superstore which is deliberating over its expansion. It wishes to know the prospective regions of the country where it could and hence requires your help.
The first thing that you will obviously need to do is import the data onto Tableau. So quickly follow the below steps:
- Since the data is in an Excel File, click on Excel and choose the Sample – Superstore.xls file to get :
- You can see three sheets on the screen, but we are only going to be dealing with Orders here, so go ahead and drag the same on Drag sheets here :
Uh oh, the imported data looks a bit different for the first few rows. Don’t worry, the solution lies right ahead.
3. You see the option of Use Data Interpreter? Click on it to get the following clean view :
All that messy data magically disappeared!
If you open the Excel data file, you will see some metadata in it, i.e. information about data :
Tableau imports the entire data file as is, but anticipating such discrepancies, explicitly provides a solution in the form of a Data Interpreter. If you wish to view the exact changes that it made, click on Review the results, and choose the Orders tab in the opened Excel sheet.
As it will show, it simply removed the erroneous data.
2.2 Data Visualisations
As soon as you had imported your dataset, next to the Data Source tab near the bottom of the screen, you immediately must have seen Go to Worksheet. A Worksheet is where you make all of your graphs, so click on that tab to reach the following screen :
Don’t get overwhelmed by the various elements that you see here, we will cover them all one by one.
Let’s start with Dimensions and Measures :
Moving onto Shelves :
Visualisation in Tableau is possible through dragging and dropping Measures and Dimensions onto these different Shelves.
Rows and Columns : Represent the x and y – axis of your graphs / charts.
Filter : Filters help you view a strained version of your data. For example, instead of seeing the combined Sales of all the Categories, you can look at a specific one, such as just Furniture.
Pages : Pages work on the same principle as Filters, with the difference that you can actually see the changes as you shift between the Paged values. Remember that Rosling chart? You can easily make one of your own using Pages.
Marks : The Marks property is used to control the mark types of your data. You may choose to represent your data using different shapes, sizes or text.
And finally there is Show Me, the brain of Tableau!
When you drag and drop fields onto the visualisation area, Tableau makes default graphs for you, as we shall see soon, but you can change these by referring to the Show Me option.
Note : Not every graph can be made with any combination of Dimensions or Measures. Each graph has its own conditions for the number and types of fields that can be used, which we shall discuss next.
2.3 Various Graphs and Charts
So far we have pretty much covered the requisite theoretical knowledge. Lets finally begin with some visualisations now.
I personally prefer to start from the shallow side of the pool, slowly swimming towards the deeper end. So I would suggest beginning by getting an overview of the Superstore Sales and Profit Statistics. That would include the Net Sales, the Net Profit and the growth of the two measures, to name a few. Here is a gist of what we will be making :
From what can be observed, the net Sales are on the rise, but the Profit is creeping up slowly. We can also quite clearly see the peak Sales Months, which could be attributed to various reasons. We can only know more as we explore more.
Before we start, there is one thing that I would like to recommend and that is you name your Worksheets as being done here. Since I will be referencing them back and forth throughout the article, it will be easier for you to follow.
Let’s begin with the simplest visualisation, and that is displaying the Net Statistics numbers. Tableau, being as smart as it is, automatically computes such values under Measure Namesand Measure Values. Follow these steps to make what is called a Text Table :
- Drag Measure Names from Dimensions onto the central empty area so that you see a Text Table.
- Measure Names will be displayed automatically onto Rows, so drag it from Rows to Columns.
- Since we don’t really need Measures like the Row ID, Discount etc, you can drag them off from below the Marks Pane, to get something like this :
Note : Don’t get confused by the different colours of the fields that you see. Just remember one small trick : Blue means Discrete and Green, Continuous.
So we have the net Sales and Profit values, let’s delve a little deeper by getting the Sales and Profit Values over the years. Lets make another, but a more detailed, Text Table :
- Drag Order Date from Dimensions and Sales from Measures to Rows.
- Right click on the green Sales Pill, and select Discrete, in place of Continuous, since we want the explicit values and not the bar graphs.
- Finally drag Profit on the ‘abc’ column to get :
- Do the same thing for Monthly Sales and Profit Values, but this time change the format of Order Date, from Year to Month, by right clicking on Order Date in the Rows, and choosing Month, to get something like this :
We have just covered the numeric part of the Dashboard, but that is not its selling point. It’s the Line Charts. Lets quickly learn how to make one :
- To create the chart of Sales and Profit Growth, drag Order Date over the Columns, Sales over Rows and then Profit over the formed Sales axis – so that you see an equals sign – to get the following :
- Repeat the same to find the Peak Sales and Profit Months, but again change the format of Order Date, from Year to Month, and get :
If you were to click on Show Me, you will see the different types of Line Charts that you can make, and if you were to hover over each of them, you will get to see their Dimension and Measure requirements too. In case you ever feel lost, I recommend referring to Show Me.
With the previous visualisations, we had gotten a brief overview of the Superstore. Let’s dig a little deeper now. The next thing that I can think of exploring is the demographic of the Sales and Profit. What are the States that have the highest Sales Revenue, which ones are generating the maximum Profits:
Before discussing the inferences, let’s first create the Pie Chartof Region Sales :
- Drag Regions onto Rows and Sales onto Columns.
- Go to Show Me, and select the Pie Chart.
- And finally drag Sales over the Label in the Marks Pane to get :
From the visual it’s pretty evident that the two opposite ends, East and West are leading in the Sales game. Let’s dissect this a bit more.
Note : Whenever you have some geographical data, it is always advisable to plot and see it on a Map to gain better insights.
So, we are now going to make the Map Chart of State Sales Distribution :
- Since its the States that we wish to analyse, drag States onto the empty area, so that you automatically see a Map, with small Circles. Follow this step by dragging Profits next. You will notice the size of these circles changing to represent the varying values of Profits. This is called a Symbol Map. But we are going to convert this into a Filled one, by going to Show Me, and selecting the Filled Map.
- Drag Profits again, but this time onto Label in the Marks Pane, to view the Profit Values mapped as well, like so :
California and New York are the top most sellers from West and East region, but unfortunately there are other States such as Texas, Colorado which even after having good Sales, have negative Profits! This is certainly not good news for the Superstore. You can perceive a good analysis for the other States as well.
And lastly, here are the steps for making the Scatter Plot of Sales and Profit Analysis :
- Drag Sales onto Rows, and Profit onto Columns. You will see one tiny circle, which actually represents the Total Sales and Profit Values.
- To get more information, drag States onto the graph created, so that these circles / bubbles scatter to represent the individual States.
- To better understand the central tendency of the data, we have also added a Median axis as Reference Line. This can be easily done by right clicking on the Sales / Profit Axis – > Adding Reference Line and choosing Median over the default Average Reference.
- Finally for some more insight, drag States again, but this time onto Label in the Marks Pane, and get:
The findings from the Map chart become more prominent with the following Scatter plot inferences :
- The states in the top right, with high Sales and high Profits mean good business for the organisation.
- States with positive Sales and Profits, but near the two respective axis are the ones where there is some scope of improvement.
- Whereas the states that belong to the 2nd or 3rd quarter are the ones which are not generating much revenue.
One of the great things about Tableau is that it lets you interact with the visuals. Have a look at an example :
When we clicked on the Central Region, it highlighted and showed the Central States of US, along with their respective Sales and Profit scatter. Here we used the chart as a Filter itself which is a feature of a Dashboard. We shall learn how to make one at a later stage.
There is one pretty important analysis that we have yet to touch, and that is Product Statistics. High Sales could be easily attributed to the high cost of the products being sold. Also, when you are considering expansion, you will want to know the Sales distribution of the Products too:
Here we have visualised not just the Sales but also the Profits.
Its quite surprising to see Categories that have high Sales, generating negative profits, like Technology in November 2015, or Furniture in October 2016 and this is inferred from the first chart, which is also called a Highlight Table. As the name suggests, it highlights the relative proportion of the Measure Values of our data. So let’s learn how to make one :
- Drag Category and Order Date ( Year ) in Rows.
- Drag Order Date (Month ) over Columns, and Sales over the empty ‘abc’ fields
- Select Highlight Table from Show Me, and drag Order Date ( Year ) back to Rows, in case it got re-shuffled.
- Finally drag Profits over Colour in the Marks Pane, to get :
The Product Sub Category Sales is a Bar Chart, which is also quite easy to make :
- Just drag Sub – Category over to the Rows
- Drag Profit onto the Columns.
- Go to Show Me and choose the Horizontal Bars
- For some customisation, drag Sales over Colour in the Marks Pane to attain this final visualisation :
From the the above graph, we are getting a good idea of the Net Sales and Profit margins of the various products. Notice that even though Tables’ Sales are quite high on the scale, it’s the only product with the least profit.
Now, just like before, consider an interaction with the visualisation :
We are now able to view each Category’s Products’ Sales and Profits, at a low level granularity of Year and Month!
3. Other Functionalities
Congratulations! You have now covered one of the important aspects of Tableau! But it’s not the end of your learning just yet. Tableau offers some advanced functionalities too, some of which we will cover next :
Till now we have only made simple charts, that actually provide cumulative data, that is combined data over the lifetime of the Superstore. To look at Sales of a particular Year, a Month, for a certain Product, or to basically view the distinct aspects of the data, Filters are the way to go.
Let’s head back to the first ever Chart that we had made, of Peak Sales and Profit Months :
The visual here is an accumulation of all 4 years of data, for all Regions, States, Categories and Sub Categories.
The steps of turning any Dimension into a Filter are the same. Let’s first experiment with the Order Date ( formatted to Year ) :
- Drag the Dimension to the Filters’ Shelf, to see the following pop up. Here we will be choosing Years :
- Choose the values that you want to be a part of your Filter :
- Right click on the newly generated Filter, and then choose Show Filter :
- You can also change the format of your Filter, for example whether you wish for a Dropdown list, a Slider, a Single Value List, etc :
- If you feel that some of your filters can be applied to other sheets as well, then rather than repeating the steps, you can simply Apply the Filter to all other relevant Worksheets :
3.2 Drill Down and Drill Up
By now you must have gotten some picture of the way our Data is built. We have Category as the main Field, divided into Sub – Category, which is further distinguished into the various Product IDs and their corresponding Product Names.
This concept of breaking down our data to reach the absolute depth is called Drilling Down :
Similarly you can drill down from Order Date to Order ID to Ship Date to Ship Mode. This is also referred to as making an Hierarchy of data.
Let’s consider the ProductDrillDown first, which is really a Bar Graph :
- First you need to group the Dimensions you want in a single Hierarchy. So, drag Sub – Category from Dimensions on top of Category in the Dimensions itself, and change the Name of the hierarchy to Product.
- Now drag Product ID and Product Name over this ProductHierarchy
- Do the same for Order Hierarchy to get :
4. To finally plot your data, drag the Product Hierarchy onto Rows and Sales onto Columns, and get:
This was just a simple Bar Graph, but if you hover over the Category axis, you will see a small plus sign. Click on it to get a granulated version of your data. Do the same for the other generated axis as well to get to the absolute depth.
The Tree Analysis of Product Sales is a Tree Map, which is a great way of representing Drilled Down data, and is quite easy to make :
5. Following the drill down from Step 4, simply go to Show Me and select the Tree Map chart, to get the following :
So far you have analysed the present scenario, but for expansion consideration, let’s try and analyse the future too.
With the following Dashboard, you can not only see the Trends over the Sales Months, but also a Forecast over the Years too. And both of them tell a different story altogether :
Although the Sales of the Superstore are increasing over the the months of a Year, the future in general looks a bit bleak. The sales seem to become constant for the next 3 years, but fortunately for the Superstore, the Profit is increasing steadily. Let’s get to making the above now.
3.3 Trend Line
Traverse back to the Peak Sales and Profit Month Chart and follow these steps to make a Trend Line of your own :
- Go to Show Me and choose the Dual Combination chart, to get this chart :
2. To get the Trend Line, go to Analytics, and simply drag Trend Line over the chart, to get :
For forecasting, we are going to deal with the Sales and Profit Growth chart. The construction is similar to that of Trend Lines, but with a small change. The steps are :
- Drag Forecast over the chart.
- You can also change the time frame of the Forecast, by right clicking on the Forecast Area and opting for Forecast Options, after which you can make your customisations :
Let’s head back to the Sales and Profit Analysis chart that we had made. Remember the detailed inference that we had generated from it? We are just going to make that a bit more prominent now, using Clusters. To make them :
- Go to Analytics and choose Clusters.
- You can format the Cluster formation as per your wishes. Here we are clustering based on the Sum of Sales and Profit, choosing the number of clusters to be 4 :
- To view the Cluster information, right click on Clusters in the Marks Pane, and select Describe Clusters, to get this pop up :
I am sure by now you must have gotten a pretty good idea of what a Dashboard is, having seen it plenty of times all throughout this article.
If not, well then a Dashboard is simply a means of combining Worksheets together so that they convey some message. Without much further ado, let’s get right to it!
Consider the State Sales Distribution Map chart and Product Sub Categories.
What if you wanted to know the various Sales margin of each Product within separate States? We had observed that Texas was one of the States with the lowest Profits. By looking at the following Dashboard, you will see that the reason is it’s not managing to generate Profits in majority of the Products :
Now consider the state wise Sales distribution of a Sub – Category :
The above beautifully shows the distribution of Appliancesover the country, where California seems to be the major Profit contributor.
Making such a Dashboard is actually quite easy. Let’s see how :
- This time instead of creating a New Worksheet, we are going to create a new Dashboard. Click on the window like iconnext to the ‘New Worksheet’ icon in the bottom pane to get the following :
- See the multiple Worksheets that we had made till now over on the left? All that we have to do to make a Dashboard is drag these sheets from the pane to the empty area ‘Drop sheets here’.
- So to make the previously displayed Dashboard, simply drag State Sales Distribution and Product Sub Category Sales. The Dashboard will automatically make space available for both of them.
Note : Even after the creation of the Dashboards, you can still edit your Worksheets, and the same changes shall be reflected here.
If you were to click on the States or the Products after creating your first ever Dashboard, you won’t observe any change. Because for such visuals, we first have to convert the Charts themselves into filters.
4. Simply click on the small Down Arrow on each chart you wish to turn into a Filter, and select Use as Filter:
Note : While making Dashboards, it is preferred to use your charts as Filters, rather than cluttering up the view with custom ones.
5. Story – Bringing it all together
Just like Dashboards were a way to combine the Worksheets, a Story is where you combine all the dashboards, and if need be individual Sheets as well, to convey, as the name suggests – a Story.
- Just like before, you simply drag your Worksheets and Dashboards onto the empty space :
So let’s combine all those Dashboards that we had made into what could perhaps make a decent presentation for a beginner. Do ensure to Add a Caption to all of your Dashboards, to convey your message clearly :
If you have ever come across Tableau Stories online, the ones which you could actually interact with, instead of just viewing, that is made possible by publishing your Workbooks onto the Tableau Server.
If you have one set up, then all you need to do, after creating your Stories, is go to Server -> Publish Workbook and enter the Server Name :
6. End Notes
What we have covered so far is pretty much the basics of Tableau. It has various other features which I will be covering in my forthcoming articles.
As it is said ‘With practice, comes perfection’, it is suggested that you experiment as much as you can with Tableau.
Below is a sample Dashboard that I would encourage everyone of you to try and make. You will not only get to test the skills that you have learned so far, but also hopefully acquire more. The dataset used is the same as the one we had been working with so far :
If there are ever any doubts, do leave them as comments 🙂
All the best on your journey as a Data Explorer, and stay tuned for my next article on Tableau!
Tableau 10 A-Z: Hands-On Tableau Training For Data Science!
Source viva: https://www.analyticsvidhya.com/blog/2017/07/data-visualisation-made-easy/