How to Visualise Data in Tableau

This tutorial will introduce you to Tableau and data visualisation. It will use an example of data downloaded from Destasis, Germany’s Federal Statistical Office, to visualise Germany’s 2020 International Trading Partners by Turnover, Export and Import values. You can access the original and the latest data from this page, or you can download its transformed version in a CSV format here.

Step 1: Import and Inspect Data File

Before you can start visualising data, you need first import the data file. Tableau makes it very easy by having a list of possible data sources available on the first screen’s left side. As our data file is in a CSV format, click on the Text file source and select the data file you want to import.

After a while, you should be able to see a data file extract with the following three columns:

  • Country: An origin/destination from/to which Germany imports/exports its goods
  • Activity: A category of trade, e.g. Imports, Exports, or Turnover
  • Eur(000): The value of the trade activity expressed in 000s of Eur.
importing germany trade csv file into tableau example

Step 1: Example of Importing a CSV File in Tableau

After you have inspected and understood the data set better, it’s time to use Tableau to visualise the data on a map.

Step 2: Set Up Your First Tableau Sheet

To set the data visualisation, go to the bottom of the screen and click on the Sheet 1 tab. You should now see an empty Tableau workspace divided into the following sections:

  • Sidebar: The left part of the screen where you can find the names of the data fields. Notice that most of the labels correspond to the columns in the original data set. You should also see additional fields like Latitude and Longitude. Tableau automatically generates them, and they will help display the Countries in the correct position on a map.
  • Marks: This is where you can drop one of the data fields to start your visualisation and analysis. We will primarily use the Color and Text marks, but you can drop the fields onto others to see how it affects your visualisation.
  • Workspace: That’s the largest area of the screen. Notice Columns and Rows on the top of the screen. We will use them in the latter part of this tutorial to create a Tableau table.
  • Filters: Here, you can drop one of the Tableau fields to limit the number of values displayed and set conditions for their selection.
setting up a new tableau data visualisation sheet

Step 2: Example of Setting Up a New Sheet in Tableau

Note how Tableau assigns different colours to the fields. For simplicity, assume that the blue labels in our example correspond to descriptive values such as labels (e.g. country name), and green ones correspond to measure values (e.g. trade value). To read more about the difference between green and blue fields, go to this Tableau’s page.

Step 3: Use Tableau Map to Visualise Geographic Data

To display your Tableau data on a map, drag and drop the Country field into the middle of the empty workspace. After a short moment, you should see a map with several dots spread across it. While this is a good start, you want to make the visualisation more meaningful. Drag the EUR(000) field from the sidebar and then drop it onto the Color mark. Consequently, you should see that Tableau has now filled the map with different colours.

Upon inspection of the map, you should notice that the shade of the colour corresponds to the total value of the trade. For example, dark blue relates to the highest numbers. Therefore, you can already see that the biggest of Germany’s trading partners in 2020 were countries such as China, the Netherlands, United States, France or Poland.

setting up data map visualisation in tableau example

Step 3: Example of Setting Up a Map Visualisation in Tableau

Notice that some of the countries on the map, for example, Libya, are blank. There is also a “21 unknown” text displayed at the lower right corner of the Tableau map. The missing colour and the notification indicate a mismatch between the country names from the original data file and what Tableau would expect to see.

To assign the missing locations to the correct value, go to Tableau’s Map menu and then click on Edit Locations… You should now see a list of territories with Unrecognised red text in the corresponding Matching Location column. Click on one of them and start typing the country name to find the right match. Once you have finished, click OK, and you should see that the map now displays the locations as expected.

Step 4: Add Filters to Improve Your Data Visualisation

Let’s use a filter to add an ability to visualise data based on a selected value. To add a filter in Tableau and limit the selection to just one category:

  1. Go to the sidebar and drag a relevant field (in our example, this will be Activity) and drag it into the Filters pane.
  2. Right-click on its name and select the Show Filters option. You should see the list of activity names on the right of the screen.
  3. Click on the black arrow to the right of the filter title and then choose Single Value (dropdown).
setting a single value dropdown filter in tableau

Step 4: Example of Creating a Single Value Drop-Down Filter in Tableau

You should consequently see a drop-down menu with a list of the Activities. Iterate between Turnover, Export, and Import to test how your selection affects the Tableau map’s visualisation.

Step 5: Create Parameters and Combine Them with Filters

In the following steps, we want to keep the existing Tableau’s map visualisation but display trading partners of Germany with the highest turnover only. To limit the number of countries displayed, you first need to create a Top N parameter. To create a parameter in Tableau:

  1. Click on the black arrow on the sidebar, just above the Tables title, and select Create Parameter…
  2. Type in Top N as the name field at the top of the Parameter Window.
  3. Choose Integer as the data type, set the Current Value to 5 and then pick Range from the list of Allowable values.
  4. In the Range of Values section, check the Minimum box and set it to 0. Then, set the Maximum to 250 and Step Size to 5.
creating a Tableau parameter example

Step 5: Example of Setting Up a Parameter in Tableau

Click OK and then go to the parameter’s name in the lower-left corner of the Tableau screen. Right-click it and then select Show Parameter from the menu. You should now see a Top N slider under the Activity Filter.

Step 6: Make Tableau’s Data Visualisation Dynamic

If you change the values in the Top N slider, you will notice that it currently doesn’t affect how the map displays the data. To make Tableau’s dynamic, you need to link the parameter with a new filter.

To combine the Top N Parameter with a Country filter:

  1. Add the Country field to the Filter pane. Right-click on it and select Edit Filter from the menu.
  2. Select the Top tab in the Filter window.
  3. Click on the Field Option and replace number 10 with the Top N.
  4. Select Eur(000) from the available list below and make sure that you selected Sum in the field to the right.

Click OK. As a result, changing Top N should now affect the number of countries displayed on your Tableau’s map.

combining tableau filter and top n parameter example

Step 6: Example of Combining a Top N Parameter and Filter in Tableau

Step 7: Create a Table to Complete Data Visualisation

Let’s set up a Tableau table to aid the map visualisation. We want to display the breakdown of the trade categories and show their corresponding values. To create a new Tableau sheet, click on the + icon, which you will find next to the current tab. As a result, you should now see an empty Tableau workspace.

Creating a table in Tableau is quite similar to building a Pivot Table in Excel. To display the country names in the first columns, drag and drop the Country field into the rows section. Then, place the Activity field in the Columns section to expand the table to add other columns with activity names. Finally, drag the Eur(000) field and drop it in the space below the headers to display the values in the Tableau table.

You should now see a Tableau table with the Country names listed to the left, followed by Export, Import and Turnover columns. To rearrange the columns’ order in Tableau, click and drag the Turnover header and then move it to the left.

Finally, go to the Turnover header and click on the symbol (three lines) to rearrange the table. The table should now show the countries with the highest trade turnover first.

germany trading countries data table visualisation

Step 7: Tableau’s Table with Germany’s Trading Partners Sorted by Turnover. For the latest source data visit Destatis.

Notice that changing the Top N parameter only affect the Map visualisation, while the Country list in the table stays the same. To change it and apply the same Tableau filter to both sheets, go back to the filter’s pane in the Map sheet. Then, right-click on the Country field and select Apply to Worksheets… Finally, choose the Selected Worksheets option, tick the box next to the Map sheet and then click OK.

Step 8: Visualise Data with Tableau Dashboard

Let’s create a dashboard to bring the two Tableau sheets into one place. We want to show the map and data visualisation on the top and the table with Germany’s Turnover, Exports, and Imports values below.

To create a Tableau dashboard:

  1. Click on the New Dashboard icon at the bottom of the window.
  2. Adjust the dimensions of the Tableau dashboard by clicking on the Size values in the left pane.
  3. Choose Generic Desktop to adjust the dashboard’s width.

Drag and drop the map sheet to the top of the new tab and then place the sheet with the countries table beneath it. Then, right-click on the table window, select Fit and click on Fit Width to adjust the window size automatically.

Finally, right-click on the Map sheet name and click Hide Title. Repeat the same step for the Table sheet. To add a title to the dashboard, go to the toolbar, click on Dashboard and select Show Title. Then, Double-click on the header and change it to Germany’s Trading Partners by Turnover.

germany trade data visualisation dashboard

Step 8: Germany’s Top 10 Trading Partners – Example of Tableau’s Dashboard. For the latest data source visit Destatis.

Note that you can also use a table to change the number of countries shown on the map. For example, to turn the Table sheet into a filter, go to the upper-right corner of the dashboard’s window select the Use as Filter icon. Then, hold a Ctrl key and click on the country names to display them on the map.

Summary: From a CSV File to a Data Visualisation

This tutorial has taken you through taking a simple CSV file and converting it into a meaningful data visualisation in Tableau. First, you downloaded a data file with Germany’s international trading partners numbers and imported it into Tableau. Using the created field, you then created a map to visualise the country data.

In the next step, you made Tableau’s map more interactive by adding filters and then combining them with parameters. As a result, you were able to visualise the data by category and limit the number of countries to the most significant contributors to Germany’s trade balance.

You then created a dashboard to finalise the visualisation. First, you set up a separate table that explained the numbers in more detail. Then, you brought the Tableau sheets onto a dashboard. Finally, you turned the table sheet into a filter to make the dashboard even more dynamic.

 

Get in Touch

challengejp_data_analystHi, my name is Jacek, and I love Data. I hope you’ve enjoyed reading this tutorial as much as I enjoyed writing it! If you have any questions about data analysis in general or any topic in particular, don’t hesitate to get in touch.

To learn more about Tableau data visualisation, find out about my One-to-One Data Analytics Courses. If you are looking for help with Tableau and data visualisation or analysis, get more info about my Data Analytics Consulting services here.

 

Related Posts:

Learn How to Become a Self-Taught Data Analyst – In this post, I share my experiences and share a few tips on how I have taught myself Data Analysis.

How to Analyse Data in Excel with Power Query and a Pivot Table – This tutorial will take you through a step-by-step process of using Power Query and a Pivot Table to analyse data in Excel.

How to Use Python and Pandas for Data Consolidation and Transformation – If you are not familiar with Python, this tutorial will show you how to write simple scripts to consolidate and manipulate small and large data files.

Your First Steps in Excel Beginner’s Crash Tutorial – This tutorial will give you a quick overview of the main functionalities and formulas in Excel and show you how to set up your first spreadsheet.

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.

,
Menu