NETWORK MAPS IN TABLEAU – USING MAKELINE

In earlier versions of Tableau, to generate Network Maps you had to duplicate your data. See the original approach to creating Network Maps on the blog HERE.

In Tableau 2019.2, new functionality was added to create lines between points. This means it is now possible to create Network Maps with little or no data manipulation. These new spatial functions in Tableau are called MakeLine and MakePoint.

Using a few steps in Tableau, you can quickly generate meaningful Network Maps for your company. I will walk through an example to produce a simple Supply Chain Network Map with some data from Melbourne, Australia.

Example Network Map

Chart: Final Network Map

PART 1 – load the DATA

Go ahead and download the data file and the workbook to follow along.

Open the excel file and under the ‘MapData’ tab. You will see our data is formatted, such that each row contains warehouse location (with a latitude and longitude), a customer location (with a latitude and longitude) and a demand quantity. The objective is to visualize the distribution points from each warehouse.

Chart 1: Network Map Data

PART 2 – CREATE A NETWORK MAP IN TABLEAU

2.1 CONNECT THE DATA

Open up a new sheet in Tableau (make sure you are using a version after 2019.2) and add a new data connection. Connect to the excel sheet and use the tab ‘MapData’ if you are using the downloaded data set.

Chart 2.1: Connect the Data

2.2 CREATE CALCULATED FIELDS - Routes

We will create two calculated fields. The first one we will call ‘Routes.’ This calculation will draw a line between two points. You will see that we first convert each latitude/longitude pair into spatial data format. We then use Makeline to form a line between the ‘from’ / ‘to’ pairs. Create a new calculated field and copy the below into the equation:

MAKELINE(MAKEPOINT([Latitude From],[Longitude From]),MAKEPOINT([Latitude To],[Longitude To]))

Chart 2.2: Calculated Field ‘MakeLine’

2.3 CREATE CALCULATED FIELDS - POINTS

Next, create another calculated field called ‘MakePt Destination’. We will use this calculation to show the destination points (customer locations) on the map. Copy the below into the equation:

MAKEPOINT([Latitude To],[Longitude To])

Chart 2.3: Calculated Field ‘MakePoint’

2.4 - CREATE THE ROUTES

Drag the calculated field ‘Routes’ onto the canvas. Once you release the mouse, you will notice Latitude and Longitude are automatically populated on the map.

Chart 2.4: Create Routes

2.5 - CREATE destinations

To create destination points on the map, we will add a dual axis. Go ahead and drag in a second ‘latitude (generated)’ onto the rows. You will now see a second chart below and some additional data on the ‘marks’ section on the left of the chart.

Chart 2.5.1: Second Axis

Next, go to the ‘Marks’ section on the left of the map and click on the second ‘Latitude (generated)’ name. Click on the dropdown and change from ‘automatic’ to ‘shape’. We will use shapes to generate circles for the customer destinations

Chart 2.5.2: Change Second Axis to Shape

First remove the ‘Route’ pill from the second axis Make area as we will be adding the ‘MakePt Destination’ field instead. Next, to add the destination points, drag on the calculated field ‘MakePt Destination’ to the Details icon, ‘To Name’ to the Label icon and ‘Demand’ to the Size icon. ‘

Chart 2.5.3: Add Details to the Second Axis

2.6 - CREATE ORIGIN Name

To add the warehouse origin name, revert to the first axis by clicking on the first ‘Latitude (generated)’ in the Marks section. Then drop ‘From Name’ to the Label icon. If you want to edit the font size and colour, you can click on the menu Format -> Font and edit the pane font. You can also change the colour of the destination points by clicking on the colour icon in the ‘Make’ area.

Chart 2.6: Add Origin Names

2.7 - COMBINE THE TWO AXES

To combine the two axes to a single view, click on the second ‘Latitude (generated)’ and scroll to ‘Dual Axis.’

Chart 2.7.1: Combine the Axes

You should then end up with a network map that looks like the below.

Chart 2.7.2: Final Network Map

 

Well done! You have created a very useful Network Map in Tableau to help you visualize your Supply Chain, all without having to manipulate the underlying data.

If you have found this post helpful, please donate to the below Bitcoin address.


19TtNdp8FBgh5YbZRy4HXAaba3oGUSxeTR

Leave a Comment