Lift a chestnut! Tableau Tips (121): Connect the MAKEPOINT and MAKELINE functions

发布于: 2021-06-08

MakePoint and Makeline function functions, effectively solve the application of the connection map and more depth data exploration. Here, thank you from @

 

The Tableau tricks we have to share with you this issue are: Use the MakePoint and Makeline function to connect maps.

Implementing the wiring map, the most critical part is to do data preparation. The data source structure used by chestnuts is as follows. After mastering the method, data powder can try to use its own data source.

 

Tips: Description of the chestnut data structure (data powder can be used as a self-built data, and patients with lazy cancer can also find private letters).

 

Specific steps are as follows:

1. Connect the data source

Open Tableau Desktop, connect the chestnut data source, as shown below.

 

2. Create a calculation field with the MakePoint function

After connecting the data source, first create two calculation fields with the MakePoint function: Departure Point and Destination Point

The calculation field is as follows:

MAKEPOINT([latitude(departure)],[longitude(departure)])

MAKEPOINT([latitude(destination)],[longitude(destination)])

Tips: makepoint ([latitude], [longitude]): Returns the spatial object constructed according to latitude and longitude.

3. Create a calculation field with the makeline function

Then, create a calculation field with MAKELINE: Line

The calculation field is as follows:

MAKELINE([Departure Point],[Destination Point])

 

Tips: makeline ([start], [end]): Returns the line based on two points.

4, create a chart

To drag and drop the "LINE" to the "Details" of the tag card to generate a wired map.

 

Press and hold the Ctrl button to click the "longitude" capsule on the column, drag and drop to the columns on the right side of the capsule to complete the "longitude" capsule. At this point, two maps appear in the view.

Next, the calculation field "DEPARTURE POINT" Drag and drop "Details" in the "Sedong (Generated) (2)" tag card.

 

Switch the tag card to all, drag and drop the dimension "city" in the "color" of the tag card;

Switch the tag card to the longitude (generated), drag and drop the dimension "city" in the "label" of the tag card.

 

Right-click the second "longitude" capsule on the column, in the drop-down menu, select "Double axis". And adjust the circle to the appropriate size by the "size" on the tag card.

Finally, adjust the color and fonts as needed. New dashboard, drag and drop the worksheet of the chart to the dashboard, the final result is as follows:

 

This issue of Tableau skills, have you get? Try it quickly!