nadav_n
nadav_n

Reputation: 45

Creating a Pie Chart distribution on a map in Tableau

I use Tableau Public. The goal is to show the distrbution of fruits in different locations using pie charts.

The source excel file contains:

column 1: location_name
column 2: Lon
column 3: Lat
column 4: apples
column 5: bananas
column 6: oranges

I put the lon and lat in rows and columns, with the location_name in the Details, and I get points of the locations. Then, I'm not able to present the fruits data together in a pie chart format.

Thank you for your help

Upvotes: 0

Views: 62

Answers (1)

Alex Blakemore
Alex Blakemore

Reputation: 11921

The easiest way is to use Tableau’s pivot feature to effectively reshape the data to have these columns: Location, Lat, Lon, Fruit, Amount

So each row in the original data set will be transformed into three rows in the pivoted version. Then visualizing the data will be much easier.

You can select columns to pivot on the Data Source page. See the help documentation on Pivots if you have trouble. You can also pivot in Tableau Prep.

If your data is sparse, say if several locations don’t produce all three types of fruit, you can often improve efficiency by adding a data source filter after pivoting to remove the rows with null Values — null Amounts in your case.

To place Pie charts at each location. Choose the Pie Mark Type, and put:

  • Location on Detail
  • AVG(Latitude) on Rows
  • AVG(Longitude) on Columns
  • Fruit on Color
  • SUM(Amount) on Angle

Adjust size, colors, border to taste. Add fields to the Label shelf as desired

enter image description here

Upvotes: 1

Related Questions