Marimekko Part 3: Table calculations

Data

Marimekko Part 3: Table calculations

by Rob Austin
//

In Part 2 we simulated a Marimekko using stacked bars but since the boundary for each element / polygon of a Marimekko in Tableau is made up from 4 Cartesian Coordinates we are going to use scales of 0 – 100 % for both X and Y axis and plot each corner of the polygon accordingly. This means that we will need a to calculate different values for various Points (1-4) for any given X or Y Dimension. We can use logical IF and CASE statements in our calculated fields to achieve this. Please note that [Point] should be dragged to Dimensions in the data window.

[X Axis]:
IF ATTR([Point]) = 3
THEN PREVIOUS_VALUE(0) + [X%]
ELSE PREVIOUS_VALUE(0)
END
DTC > Compute Using: Advanced > Addressing: X Dimension, Point; Sort: Automatic

[Y Axis]
ZN(PREVIOUS_VALUE(0)+
CASE ATTR([Point])
WHEN 1 THEN ZN(LOOKUP([% of Y within X],-1))
WHEN 2 THEN [% of Y within X]
WHEN 3 THEN 0
WHEN 4 THEN [% of Y within X]*-1
END)
DTC > Compute Using: Advanced > Addressing: Y Dimension, Point; Sort: Sum of Sales Decending.

Dimension, Point; Sort: Sum of Sales Decending.

Screen Shot 2014-01-03 at 14.14.02 Screen Shot 2014-01-06 at 09.29.07

When dealing with complicated table calculations it is best to start with a table of data, that way you can get a feel for what the calculations are really doing and make sure there are no mistakes before you create your viz. In the Crosstab above I have put [X-Dimension] in to columns, [Y Dimension] and [Point] in to Rows. I then drag [X Axis] in to the workspace followed by [Y Axis] to make use of measure names / measure values. Lastly I sorted the dimensions to make sure that they appeared in the same order as my table calculations.

In the X Axis calculation above we are putting the previous value in for points 1 and 2 (or Zero if there is no previous value) we are then incrementing the value for point 3, it is behaving as a running sum for each Y Dimension along the X Dimension but only incrementing at point 3 (this means that point 4 will be the same as point 3 for each X Dimension. The value of the increment is calculated using [X%] as described earlier in the blog series.

The Y Axis calculation is a little more complicated as the values are not common to each Y Dimension but run along the Y Dimension (and Point). It restarts for each X Dimension calculating the result from the previous value along the Y Dimension and Point.

If you understood that on your first read then you are doing very well. The table above illustrates how the results should look and may be easier to digest.

In Part 4 we will be putting these calculated fields in to a Mekko.

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 →

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

×

Love our blog? You should see our emails. Sign up for our newsletter!