In Part 3 we created all the calculated fields necessary for our basic Mekko. Because we have preset the DTC (Direction of Table Calculation) for each calculated field we can simply drag them on to the view to create the mekko and be confident that the values will match our table.
Mark Type: Polygon
Color: [Y Dimension] (sorted ascending along sum of sales to align the ledgend)
Path: [Point]
Detail: [X Dimension] (sorted descending along sum of sales to show the biggest first)
Columns: [X Axis]
Rows: [Y Axis]
The figures / labels on the Mekko are the next step. We are going to have to create another 3 calculated fields to get them in the correct position.
[Label X]
IF ATTR([Point])=3 THEN [X Axis] – [X%]/2 END
This field creates another cartesian point between points 2 & 3.
[Text]
‘
‘+
LEFT(STR(ROUND([% of Y within X],3)*100),4) + ‘%’
This field ensures that the label displays below the line for each element.
[Text (Hidden)]
IF [X%] > 0.05 THEN [Text] END
This is an optional field depending on your data which hides labels where space is limited.
To display the labels in the same view we are going to make use of Dual Axis and then synchronize and hide the second axis. For the 2nd Axis we should have the following settings:
Columns: add Label X to the right of the existing X Axis
Mark Type: Text
Text: [Text] or [Text (Hidden)]
Detail: [Y Dimension], [X Dimension], [Point], [% of Y within X]
This version of the Marimekko chart requires full data densification (i.e. you need to have a row of data for each combination of X Dimension & Y Dimension). If you are missing a row of data then the running calculations will not compute correctly and will not add up to 100%. Try Selecting Y Dimension > Department and X Dimension > Container to see the issue in the viz above.
We will solve this issue in Part 5 of the blog and add some totals.