Tableau is a very user-friendly tool that helps us visualize our data with a simple drag and drop technique. In the previous recipe, we saw how to connect to the data, and in this section, we will create our very first visualization and get acquainted with the Tableau workspace.
We will continue from where we left in the previous recipe where we are still connected live to the Orders
sheets of Sample - Superstore.xls
. Let's quickly build our first view and then understand the workspace of Tableau.
Orders
sheets of Sample - Superstore.xls
by following the steps mentioned in the previous recipe.After having established the connection to the data and having read the data in Tableau by clicking on the Go to Worksheet option and then the Sheet 1 tab, we get the view where we will create our visualizations. Refer to the following image:
The preceding image gives us a quick glimpse into the Tableau workspace. Let's understand this workspace in more detail:
Tableau – Book 1
or so. However, we can change the name once we save the workbook.The Data pane, as the name suggests, shows the data to begin with, which is populated from the data source that we have connected to. The top section of the Data pane displays the data source that we have connected to. In the case of multiple data sources, we will see a list of data sources.
Further, just below the data source section are the fields available in that data source. Refer to the following image:
The Data pane is primarily divided into two sections: Dimensions and Measures.
Dimensions are all the descriptive fields in our data. These are fields that hold categorical/discrete qualitative data. In short, any field that contains text or date values will be identified as Dimensions, for example, customer name, purchase date, customer state, and so on.
On the other hand, Measures are all the fields that contain numeric values. These are fields that hold quantitative data, for example, sales, profit, budget, and so on. Typically, Measures are the fields that will be aggregated while analyzing. For example, we may want to see the sum of sales across regions, the average sales for a particular category, and so on.
Basically, Dimensions and Measures are Tableau's way of classifying our data fields. At a little later point in time, you will understand how Tableau is capable of doing this classification, and in case we wish to change it, then how to go about it.
Further, the Data pane may additionally accommodate sections for Sets and Parameters, functionalities that we will explore later.
The Analytics pane, on the other hand, provides quick and easy access to features such as reference lines, box plots, trend lines, forecasts, and so on. We will explore these options at a later stage. To begin with, the Analytics pane may be disabled/grayed out. However, once we start creating our visualizations, then depending on the visualization, some of the options from this pane will be enabled/disabled for us. Refer to the following image:
We shall explore these various shelves in more detail as we progress with our understanding of Tableau.
In the earlier section, we read about Dimensions and Measures. As a quick recap, Dimensions are basically fields that contain categorical/descriptive/qualitative data, such as text and dates, whereas, Measures are fields that contain numeric/quantitative data that can be aggregated.
Dimensions and Measures are the fundamental building blocks of our analysis, and it is very important that they are identified correctly. As mentioned earlier, Tableau is capable of classifying our data fields as either a Dimension or a Measure, and it does so based on the data type of the fields.
So, what data types are supported by Tableau and how does Tableau identify them? When we connect to a database, the data types are already defined in the database and that is what Tableau would read. However, when we connect to typical flat file formats, such as Excel, Access, or CSVs, Tableau will read the data types of the first 10,000 rows of an Excel data source or the first 1,024 rows of a text file data source. Once it does this, it will accordingly decide the data type of that field. So, in an Excel file, if most of the first 10,000 rows are numeric values, the entire column is mapped as Integer.
Before version 8.2 came out, Tableau used Microsoft Jet Engine to connect to Excel, Access, and CSVs. We call this a legacy connection. However, with the latest versions, there are new connectors that are being used for connectivity to Excel and CSVs. With the legacy connection, the datatype mapping was done by reading the first 16 rows of the data for Excel, Access, and CSVs.
Each field under the Dimensions and Measures section will have a prefixed icon before it. These are the data types supported by Tableau and are identified in the Data pane by one of the following icons:
Is it possible to change the datatype of the fields in Tableau? Yes! Ideally, it is recommended that we handle all the data-related changes at the data source level. However, if we feel that Tableau has incorrectly identified the data type of a certain field, then we can right-click on the field in the Data pane, select Change Data Type, and then select the appropriate data type. Refer to the following image:
Once Tableau identifies the data type, it simply classifies all String and Date / Date & Time data types as Dimensions and all Integer data types as Measures.
Why is Row ID a Dimension even though its datatype is Integer? Even though Row ID is a numeric field in this case, taking a sum or average of Row ID won't be useful. It is actually a descriptive field that gives us information about the transaction. Since the header/field name contains the word ID, Tableau assumes that it is an identifier and hence places it in the Dimensions shelf.
Is it possible to convert a Dimension to a Measure and vice versa? Yes! It is easily possible to convert Dimension to Measure and vice versa. To do so, we can simply right-click on the Dimension field and select the option of Convert to Measure. If we right-click on the Measure field, then we get an option of Convert to Dimension. Refer to the following image:
We can also drag Dimension fields and then drop them into the Measures pane and vice versa to convert them from Dimensions to Measures. The same method can be used to convert Measures to Dimensions as well.
When we connect to the data, apart from reading the data fields and classifying them as Dimensions or Measures, Tableau also autogenerates certain new fields in both the Dimensions and Measures pane. They are as follows:
18.222.32.67