Marimekko Part 1: Polygons, Paths and Custom SQL

Data

Marimekko Part 1: Polygons, Paths and Custom SQL

by Rob Austin

Before we can attempt a Marimekko, we need to understand a few of Tableau’s lesser used tools.

The first of these is the Polygon mark type which can be selected from the dropdown on the marks card. Since the Marimekko is actually made up of lots of x-y (Cartesian) coordinates we need to join the dots and colour in the middle, this is what the polygon tool does.

Screen Shot 2014-01-03 at 14.14.02

Usually when using polygons you have all the data that is necessary e.g. lat/long points on a map which define a boundary. In our case we want to use a single measure value and represent it as a polygon. This will involve replicating the line 4 times (once for each corner). To do this we must use the UNION ALL command in Custom SQL to generate the extra rows of data, we will also be adding a new column called ‘Point’ which we will use to define the corners of the polygons

Tableau Custom SQL (found in the edit connection window):

SELECT [Orders$].[City] AS [City],
[Orders$].[Customer Segment] AS [Customer Segment],
[Orders$].[Product Category] AS [Product Category],
[Orders$].[Product Container] AS [Product Container],
[Orders$].[Sales] AS [Sales],
[Orders$].[Unit Price] AS [Unit Price],
1 AS [Point]
FROM [Orders$]
UNION ALL

SELECT [Orders$].[City] AS [City],
[Orders$].[Customer Segment] AS [Customer Segment],
[Orders$].[Product Category] AS [Product Category],
[Orders$].[Product Container] AS [Product Container],
[Orders$].[Sales] AS [Sales],
[Orders$].[Unit Price] AS [Unit Price],
2 AS [Point]
FROM [Orders$]
UNION ALL

SELECT [Orders$].[City] AS [City],
[Orders$].[Customer Segment] AS [Customer Segment],
[Orders$].[Product Category] AS [Product Category],
[Orders$].[Product Container] AS [Product Container],
[Orders$].[Sales] AS [Sales],
[Orders$].[Unit Price] AS [Unit Price],
3 AS [Point]
FROM [Orders$]
UNION ALL

SELECT [Orders$].[City] AS [City],
[Orders$].[Customer Segment] AS [Customer Segment],
[Orders$].[Product Category] AS [Product Category],
[Orders$].[Product Container] AS [Product Container],
[Orders$].[Sales] AS [Sales],
[Orders$].[Unit Price] AS [Unit Price],
4 AS [Point]
FROM [Orders$]

Once we have our data we will need to make sure that it as we expect. We should have 4 lines of data now for each line in our original dataset. Each of these replicated lines should have a unique point:

Screen Shot 2014-01-03 at 14.45.14 In ‘Marimekko Part 2‘ we will look at Parameters and Table Calculations.

More About the Author

Rob Austin

Consultant
Using Tableau on your Mobile I have been using Tableau since version 4, initially as a Tableau customer. One of the first things I wanted was to be able to see my ...
Tableau Level of Detail Calculated Fields v9 In this tutorial I talk about the Tableau Level of Detail calculations  {fixed}, {include} and {exclude} which are new in Tableau ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072