Data Visualization: Working with Tableau

1. Tableau Basics

The data source field of the worksheet is preloaded with the column headers we identified on the data source page. The gray line divides the dimensions from the measures, with dimensions above and measures below the line.

Tableau divides all the data fields into two broad data types, dimensions and measures.

Dimensions: Qualitative data values, used to categorize and group data to reveal details about it.
Measures: Numeric values that can be aggregated or placed in calculations.

The green and blue colors in Tableau indicate another aspect of the list of dimensions and measures in the Tableau worksheet data tab. Blue indicates a discrete field and green indicates a continuous field.

Discrete: A measure or dimension has a finite and countable number of outcomes.
Continuous: A measure or dimension has an infinite and uncountable number of outcomes.

We should remember that Tableau may assign the wrong data type. So we need to change them accordingly.

2. Creating Basic Visualizations with Tableau

Creating a Basic Bar Chart

Steps of ‘a Basic Bar Chart’ could be like the following:
(italics are for variables from the data, bolds are for Tableau fields)

1.1 Create a New Worksheet.

2.1 Drag Date into the Columns shelf.
2.2 Click on the drop down menu of the Date in the Columns shelf, choose Year.

3.1 Drag Number Of Strikes to the Rows shelf
3.2 <This created a line graph.>

4.1 Click on the dropdown menu in the Marks field. Select Bar.
4.2 <This turned the graph into a bar chart.>

5.1 Drag Date to the Filters field. Select Years when the pop-up window appears. Click Next.
5.2 Select only 2009 and 2018 in the next pop-up window. Click OK.
5.3 <Now only these two years are shown in the graph.>

6.1 Add labels to the bars by dragging Number Of Strikes to the Label square in the Marks field.
6.2 <Now the bars are labeled at the top with the total number of strikes.>

7.1 Drag Date to the Column shelf. (next to Year-Date)
7.2 <This automatically divides the number of strikes into quarters.>
7.3 <Now both Year are side by side with their quarters.>

8.1 Drag Date to the Color square in the Marks field.
8.2 <This assigns different colors for both Years.>

9.1 Click on the drop down arrow of Year(Date) in the Marks field and select Quarter.
9.2 <Now all quarters have different colors.>

10.1 Save your work by clicking on Publish.

Showing Data on a Map

Steps of ‘Showing Data on a Map’ could be like the following:
(italics are for variables from the data, bolds are for Tableau fields)

1.1 Create a New Worksheet.

2.1 Drag Longitude into the Columns shelf.
2.2 Drag Latitude to the Rows shelf
2.3 Make sure the latitude and longitude fields are set to continuous dimensions.
2.4 <This creates a map.>

3.1 Drag Date to the Filters field. Select Years when the pop-up window appears. Click Next.
3.2 Select only 2018 in the next pop-up window. Click OK.
3.3 <By this, we filter the data so that we have fewer data points to work with.>

4.1 Click on the drop down arrow of Number of Strikes in the Tables field and select Convert to Dimension.
4.2 Drag Number of Strikes to the Color square in the Marks field.
4.3 Click on the dropdown menu in the Marks field. Select Density.
4.4 <This uses color gradients to help differentiate the denser locations on the map.>
4.5  Click on the Color square in the Marks field and change Color from Automatic to something else.

Creating a Heat Map

Steps of ‘Creating a Heat Map’ could be like the following:
(italics are for variables from the data, bolds are for Tableau fields)

1.1 Create a New Worksheet.

2.1 Drag Date to the Rows shelf
2.2 Click on the drop down menu of the Date in the Rows shelf, choose Year.

3.1 Click on the drop down menu of the Date in the Table field, choose Create > Calculated Field.
3.2 Give the calculated field a title (Month) on the pop-up menu.
3.3 Type in the code area: LEFT(DATENAME(‘month’, [Date]), 3) and click OK.
3.4 <Using the left function is to pull the month names from the string in the column Date. The code above pulls the first three letters from the month listed in the string.>

<Now there is a new variable in the Tables field called Month.>

4.1 Drag Month to the Columns shelf.
4.2 <This creates a table of years with months.>
4.3 Drag Number of Strikes to the Color square in the Marks field.
4.4 Be sure in the Marks dropdown that Square is selected.
4.5 <Now we get a heat map.>

Creating a Box Plot

Steps of ‘Creating a Box Plot’ could be like the following:
(italics are for variables from the data, bolds are for Tableau fields)

1.1 Create a New Worksheet.

2.1 Drag Date into the Columns shelf.
2.2 Click on the drop down menu of the Date in the Columns shelf, choose Year.

3.1 Drag Number Of Strikes to the Rows shelf
3.2 <This created a line graph (if Tableau doesn’t default to boxplot).>

4.1 Click on the dropdown menu in the Marks field. Select Circle.
4.2 Click on the Show Me tab (on the right up), choose Box and whisker plot.
4.3 <This creates a thin boxplot.>
4.4 Re-Drag Date into the Columns shelf.
4.5 <This adds other years as boxplots.>

5.1 Drag Date into the Detail square in the Marks field.
5.2 Click on the drop down arrow of Date in the Marks field and select Day.
5.3 <Now box plots appear in full strength.>
5.4 Use Color and/or Size squares in the Marks field, to change the colors and sizes of the dots in the presentation.

Creating a Histogram

Steps of ‘Creating a Histogram’ could be like the following:
(italics are for variables from the data, bolds are for Tableau fields)

But first, to create a histogram, we need to create bins. Bin is a Tableau term that describes the custom segments of data that values can be grouped into.

1.1 Create a New Worksheet.

2.1 Click on the drop down arrow of Number of Strikes in the Table field and select Create > Bins.
2.2 Give the Edit Bins > New Field Name a title (Bin Strikes) on the pop-up menu.
2.3 Type in Size of Bins a value (5).
2.4 <This creates Bin Strikes in the Table field.>

3.1 Drag Bin Strikes into the Columns shelf.
3.2 Drag Number Of Strikes to the Row shelf
3.3 Click on the drop down menu of the Number Of Strikes in the Rows shelf, choose Measure > Count.
3.4 <This presents the actual count of each bin.>

4.1 Drag Number of Strikes from the Table field to the Filter field.
4.2 Choose All Values in the pop-up menu, click Next.
4.3 Limit the filter numbers (from 1 to 200).

5.1 Drag Number of Strikes into the Label square in the Marks field.
5.2 Click on the drop down arrow of Number of Strikes in the Marks field and select Measure > Count.
5.3 We can adjust the color, by clicking the Color square in the Marks field too.

3. Telling a Story

We will create a series of data visualizations that work together to tell a story.

Basic organizing strategies for a presentation are chronological, generic-to-specific and specific-to-generic.

  • A chronological approach to data visualizations is useful for data that is best understood in a time series. 
  • A generic-to-specific approach helps an audience consider an issue before describing how it affects them
  • A specific-to-generic approach is useful to highlight impacts the data can have on a broader scale.
Worksheets, Dashboards, Story

Steps of ‘Creating a Story’ (a generic to specific one) could be like the following:
(italics are for variables from the data, bolds are for Tableau fields)

  • We’ll create three different tableau public worksheets.
  • One worksheet will be interactive.
  • All worksheets will be used in the Dashboards.
  • All dashboards will serve the Story.
Line Graph

1.1 Create a New Worksheet. (for a Line Graph)

2.1 Drag Date into the Columns shelf. Select Year in the drop down.
2.2 Drag Number Of Strikes to the Rows shelf
2.3 <This created a line graph.>
2.4 Click on the line points, choose Annotate > Mark, type your note (31M strikes in 2018).

(Since we want to progress from generic-to-specific, it is important to show the trend of lightning strikes moving west over the decades. To do that, we needed to create a time series map that shows the location of lightning strikes in the US for each year since 2009.)

Time Series Map

3.1 Create a New Worksheet. (for a Time Series Map) (an interactive map)

4.1 Drag X Coord into the Columns shelf
4.2 Drag Y Coord  to the Rows shelf
4.3 Make sure both X and Y Coord are marked as Continues in the drop down menu.
4.4 In the drop down menu of both X and Y Coord choose Measure > Average.

5.1 Drag Date to the Filters field. Select Years when the pop-up window appears. Click Next. Select All Years.
5.2 Drag Date to the Pages field
5.3 <The pages field can create a distinct snapshot or page of lightning strikes for each year.>
5.4 Drag Number Of Strikes to the Detail square in the Marks field.

(With the Year dimension in the Pages and the Filters fields, we can format interactive legends to the side of the data visualization. These allow users to self-select the years they wish to see.)

Each State

6.1 Create a New Worksheet. (for each state: Texas, Oklahoma and Kansas)

7.1 Drag X Coord into the Columns shelf
7.2 Drag Y Coord  to the Rows shelf
7.3 Drag Number Of Strikes to the Detail square in the Marks field.
7.4 Drag Number Of Strikes to the Color square in the Marks field.

8.1 Drag Date to the Filters field. Select Years when the pop-up window appears. Click Next. Select only 2018.

(Now we need to create a set in tableau public. A set is a Tableau term for a custom field of data created from a larger data set based on custom conditions.)

9.1 Use the Lasso tool on the Map and choose where you want to isolate on the map (Texas).
9.2 Select Keep Only on the pop-up menu.
9.3 Select again all the points, and create Set on the pop-up menu.
9.4 <A newly created set (Number of Strikes Set) is in the Table field now.>
9.5 Drag Number of Strikes Set to the Filters field. Choose In in the pop-up menu.
9.6 <Now only the average lightning strikes for Texas will show up on our map.>

Repeat these last worksheet steps for the other two states as well.

10a.1 Create a New Dashboard.
10a.2 Drag all three states into this dashboard.
10b.1 Create another Dashboard.
10b.2 Drag Line Chart here.
10c.1 Create another Dashboard.
10c.2 Drag Interactive Map here.

11a.1 Create a New Story.
11a.2 Insert the Line Chart to the Story.
11a.3 Add a Caption (on the top of the Story) to give details.
11b.1 Click New Story Point > Blank in the Story tab (on the left).
11b.2 Insert the Interactive Map to the Story.
11b.3 Add a Caption to give details.
11c.1 Click New Story Point > Blank in the Story tab.
11c.2 Insert the Three States to the Story.
11c.3 Add a Caption to give details.

Interactive Dashboard, Dynamic Stat-sheet
Map

1.1 Create a New Worksheet. (for the Map)

2.1 Drag X Coord into the Columns shelf
2.2 Drag Y Coord  to the Rows shelf
2.3 Drag Date to the Filters field. Select Years when the pop-up window appears. Click Next. Select All Years.

3.1 Be sure Number Of Strikes is converted to Dimension under the drop down menu.
3.2 Drag Number Of Strikes to the Color square in the Marks field.
3.3 <The color square will categorize the dots on the map with a color code based on the quantity of strikes.>
3.4 Drag Number Of Strikes to the Detail square in the Marks field.
3.5 <The detail square will plot the locations for each of the lightning strikes for each year.>
3.6 Be sure both Number Of Strikes are set Continues under the drop down menu in the Marks field.

(For the next worksheet, we will create a list of three metrics that will change on the dashboard whenever a year is selected. The three metrics are 

  • total number of strikes, 
  • average number of strikes for each location for that year, 
  • and maximum number of strikes in any location.

This worksheet will sit to the side of the interactive map and update whenever a new year is selected.)

Metrics

4.1 Create a New Worksheet. (for the Metrics) 

5.1 Choose Create > Calculated Field in the drop down menu of the Number of Strikes Dimension in the Table field. Then in the blank field space, type [Number_of_Strikes].
5.2 <This creates a new calculation in the Tables field.>
5.3 Drag [Number_of_Strikes] calculation into the Tooltip square in the Marks field. In the Drop Down, select Measure > Average.
5.4 Repeat the above process for Sum.
5.5 Repeat the above process for Maximum.
5.6 <This creates dynamic fields for three metrics.>

6.1 Click on Worksheet > Show Title in the main menu on the top. Edit title as follows:

Metrics for the year
* Total: <SUM(Number of Strikes)>
* Average: <AVG(Number of Strikes)>
* Maximum: <MAX(Number of Strikes)>

Average

7.1 Create a New Worksheet. (for the Average) 
7.2 Drag the Number of Strikes Dimension to the Text square in the Marks field. In the Drop Down, select Measure > Average.

8.1 Create a New Dashboard.
8.2 Drag all three worksheets into this dashboard.

(We will connect the three worksheets together with an action. An action is a Tableau tool to help a user interact with a visualization or dashboard by allowing control of a selection. When a year is selected from the filter bar, all the other fields will update with it.)

9.1 While Map is selected in the Dashboard, select Worksheet > Actions in the main menu.
9.2 In the pop-up menu, select Add Action > Filter.
9.3a In the Add Filter Action menu, select Source Sheet > Dashboard1 (our dashboard name should appear)
9.3b Check Map and Metrics only from the list (that is below the above step).
9.3c Choose Run Action On > Select (that is on the right side of the above step).
9.3d Select Target Sheets > Dashboard1 
9.3e Check Map and Metrics only from the list.
9.3f Choose Clearing the selection will > Show all values
9.3g Choose Filter > All fields
9.4 Click Next, click OK.
9.5 <Now we have an interactive dashboard.>

10.1 Click on the dashboards to the sections to change their titles to give more details.
10.2 Rearrange these sections.