SCGIS WebinarHow to Build and Deploy a Dashboard in Tableau PublicApril 5, 2016
Introduction
Since its launch in 2010, Tableau Public revolutionized the data visualization industry by allowing data analysts and visual storytellers to create and publish interactive dashboards and infographics—using an industry-standard platform with minimum exceptions and limitations—for completely free of charge.
In this tutorial, we will explore, step-by-step how to build and deploy the following dashboard in Tableau Public…in one hour… FOR FREE! J Let’s get started!
Step 1: Organize your data.
The first step to building your dashboards in Tableau Public is to organize your data in a systematic and recognizable way. Tableau Public digests the following file formats and servers:
Excel / Excel Workbooks (.xls, .xlsx, .xlsm)Text / Character Delimited Files (.csv)
Tab Delimited Files (.tab, .tsv)
Text files (.txt)
Access / Access Databases (.mdb, .accdb)
Statistical Files / SAS Files (.sas7bdat)
SPSS Files (.sav)
R Files (.rdata, .rda)
Servers / OData, Web Data Connector
For this demonstration, we will be working with a sample dataset in Excel spreadsheet format. The spreadsheet contains three categories of data for a particular project area:
Data Category / Data ElementsForest & Deforestation / Forest in 2013
Total deforestation from 2000-2013
Illegal deforestation from 2000-2013
Legal deforestation from 2000-2013
Fires / Number of fires
Percent of total fires
Agricultural Yields / Oil Palm Yield
Rubber Yield
* You can also separate data into different sheets or workbooks and join the data using common fields as keys.
Some more tips for organizing your data:
· Is it ok to have active formulas in my data?
Yes, Tableau Public will only recognize the value in the cell, not the formula that calculates the value.
· For calculations involving division by 0, is it ok to have “#DIV/0!”?
Yes, Tableau Public will ignore this.
· Is it okay if my field names are abbreviated/not spelled out?
Yes, you can customize field names in Tableau. Make sure you know what each field is.
· Will my hidden fields stay hidden after they are imported into Tableau Public?
Yes, hidden fields will stay hidden. Upon importing the data, you can change the settings to show or hide hidden fields.
Step 2: Download and install the latest version of Tableau Public (v 9.3)
Make sure you have the most recent version of Tableau Public installed to ensure you have access to the latest tools and services. The current version is version 9.3. (You may need your Tableau Public account to download the files.)
Step 3: Import your data into Tableau Public
After you have organized your data, you are ready to import the data into Tableau Public. Double click the Tableau Public 9.3 icon to start the program. At this point, you can open Tableau workbooks/ dashboards from an existing Tableau Public account (you will need to sign into the account), or start a new file. If you have never used Tableau Public before, your screen should look like this:
Connect to your dataset. Under Connect, click Excel, then navigate to your file and click Open.
After you are successfully connected to your dataset, Tableau Public will prompt you to enter the workbook sheets from the dataset that to be analyzed in the dashboard.
We will begin by creating the charts for the fires data first since it is the simplest chart. Click on the Data pill located under Sheets and drag it to the box that says “Drag sheets here”.
After the pill is dragged into the box, Tableau Public’s built-in data interpreter will show each field, the raw data, and the data type of each field. You should review each field to ensure the data type is correct and change the type if the data was not interpreted correctly.
The sample dataset should have the following field types:
Field / Data TypeDistricts / String
Forest 2013 / Number (whole)
Total Deforestation 2000-2013 / Number (whole)
Illegal Deforestation 2000-2013 / Number (whole)
Legal Deforestation 2000-2013 / Number (whole)
Number of Fires / Number (whole)
Percent of Total Fires / Number (decimal)
Oil Palm Yield / Number (decimal)
Rubber Yield / Number (decimal)
After specifying your data sheet and ensuring the correct data types for each field, you will notice that a new Sheet was created in the Tableau workbook. Click on Sheet 1 to begin creating your first chart!
You can change the name of the sheet by right clicking on the Sheet and selecting Rename. I have renamed the sheet to Fires since we will be creating our Fire occurrences chart in this sheet.
Step 4: Understanding your workspace.
On the Sheet 1 screen, you will notice that Tableau automatically splits your data fields into two data roles: Dimensions and Measures. In a nutshell, Dimensions are fields that contain categorical information, and can be discrete or continuous depending on whether they are string/Boolean, number, or date data types. When creating a graph/chart, Tableau uses Dimensions to create column and row headers. Measures are fields that contain quantitative, numerical data and can also be discrete or continuous depending on how the user would like it to be shown in the chart. When creating a graph/chart, Tableau uses Measures to create continuous axes or column headers. You can convert fields between Measures and Dimensions depending on the data type and how you want your data presented. Click for more information on Dimensions and Measures.
You will also notice that Tableau automatically created three new fields: Measure Names, Measure Values, and Number of Records. In a nutshell, Tableau automatically creates these fields to capture all of the field names and values. Click for more information on Measure Names and Measure Values.
Step 5: Create your first simple bar chart – Fires
We will begin by creating the chart for displaying fire. This chart shows the number of fires per district and uses a color gradient to display the data. Since we want our fire data organized by district, drag the Districts pill into the Columns section, then drag the Number of Fires into the Rows section to automatically create a bar graph of the data. Your screen should look like the following:
You will notice that the districts are organized in alphanumeric order and fires are only displayed in one color. To streamline the design and provide more visual clarity in the chart, we will organize the districts in order from most to least fire occurrences. To do this, hover your mouse over the Number of Fires axis until you see a symbol. Click on the symbol once to reorder the districts from greatest to least fire occurrence. Clicking the symbol a second time will reorder the districts from least to greatest fires, and clicking a third time will bring the districts back to alphabetical order. Leave the order from greatest to least fire occurrence. Your chart should now look like the one below:
We now see clearly that District 8 has the highest fire occurrence out of all the districts; however, the blue color of the bars does not quite convey that we are looking at fire occurrence data, so let’s change the bars to a more intuitive color. Since we are trying to color the fire occurrence data, click on the Number of Fires field under Measures and drag the pill to the color box. Tableau Public will automatically color the data bars using a single-color gradient—however, it might not be the most intuitive color.
To change the color of the gradient, click on the Color box under Marks, then click Edit Colors. From the Palette drop-down list, select a red or orange color to go with the fire data theme. Congratulations, you just created your first chart in Tableau! Your final chart should look like the one below:
Step 6: Create a two-tiered bar chart – Commodities
So you finished creating your first chart in Tableau—and it wasn’t nearly as painful as you thought it would be! J Next, let’s create a slightly more complex chart: the two-tiered commodities map featuring oil palm and rubber yields per district.
Click the New Worksheet button at the bottom to create a new Tableau Workbook sheet. You can rename the default Sheet 2 to something relevant to the dataset like Agriculture. Like the Fires chart, we want the data to be organized by the districts, so drag the Districts pill to the Columns section. Since we want to show both oil palm and rubber commodities in the same chart, drag both the Oil Palm Yield and Rubber Yield pills to the Rows section. Now you have a two-tiered chart!
This chart could still use some additional design changes to streamline the story being presented, and make the chart more relevant to the data analysis. Oil palm is the major driver of deforestation in this landscape, so we are most interested in which districts are producing the most oil palm. To order the charts by highest oil palm yield, click the symbol over the Oil Palm Yield Axis on the left.
Next, let’s give the two crop datasets different color gradients to better distinguish them. You will notice that the Marks menu has two tabs, one for each dataset. This allows each dataset to have its own color. Click on the SUM(Oil Palm Yield) tab and drag the Oil Palm Yield pill to the Color box to give the oil palm data in the chart a color gradient. Click the Color box, then click Edit Colors and select an appropriate color from the Palette drop down menu. We will choose the red gradient (since oil palm is the major driver of deforestation) and click OK. Repeat these steps for the rubber yield dataset. Click on the SUM(Rubber Yield) tab and drag the Rubber Yield pill to the Color box to give the rubber data in the chart a color gradient. Click the Color box then Edit Colors and select the blue gradient from the Palette drop down menu. Voila! You now have a two-tiered bar chart. Lookin’ good!
Step 7: Use Measure Values and Measure Names for a dual-toned stacked bar chart – Deforestation
For the Commodities chart, we combined two different yield datasets into one chart. However, sometimes you might have two components of the same dataset that you want to show together in the same bar chart area instead of creating multiple tiers. In this case, you would create a stacked bar chart. In this example, our deforestation data has two components: legal and illegal deforestation, and they are stacked on top of each other so we can also see total deforestation per district. In this case, we are most interested in seeing which district has the most illegal deforestation.
Create a new sheet using the same method as the previous charts and name it Deforestation. Like the previous two charts, we want the deforestation to be organized by districts, so drag the Districts pill to the Column section. However, for the deforestation data, we want both Planned and Unplanned Deforestation to be in the same graph, so we cannot simply drag both of those pills into the rows section. Go ahead, try it!
In this case, we are trying to display two datasets together in the same row. For these situations, we would use the Measure Values pill, which aggregates all the Measures pills together into one field. Drag the Measure Values pill to the Rows section; note that a new Measure Values card will appear with all the Measures pills in it. Since we are only looking at an aggregation of planned and unplanned deforestation in this chart, remove all the extra pills until only SUM(Planned Deforestation 2000-2013) and SUM(Unplanned Deforestation 2000-2013) pills are in the Measure Values card. You can hold CTRL to select multiple pills at once, and the right click once you are done selecting and click Remove. You will also notice that Measure Names has been added to the Filters card, and your bar graph is divided by category.
Now, we want to give each category of data its own color. In this case, we need to take the same mental approach—we are trying to color the data using more than one Measure. Drag the Measure Names pill to the Color box in the Marks card. You now have a dual colored stacked bar chart!
Tableau will automatically give each category random colors by default, so let’s give the chart some meaningful colors. Since unplanned deforestation is on the bottom and is the most important aspect of the chart, let’s give that a darker red color and planned deforestation—which is less important to us—a lighter red color. Click the Color box and then Edit Colors. Click the drop-down menu under Select Color Palette and select the Red gradient palette. Select Planned Deforestation 2000-2013 and select a light red color for it. Do the same for Unplanned Deforestation 2000-2013 and select a dark red color for it. Click Apply to test the colors and once you are satisfied with the color choices, click OK.
Congratulations! You successfully used Measure Values and Measure Names—two incredibly valuable tools—to create a stacked bar chart!
Step 8: Create a bubble chart – Forest
So far we have been exploring how to create different kinds of bar charts; however, you may want to display your data using a different kind of chart, or use a different chart type to create a more interesting visual display. In this step, we will create a bubble chart out of the forest data, so start out by creating a new worksheet and rename it as Forest.