Marimekko charts in Tableau do require some effort. We need to think about what values each mark needs to be plotted in the right place with the right size and color. With that in mind, let’s start out looking at the data. The data for the six departments is taken from the R UCB Admissions sample data set:

This is a tall data set with three dimensions—Department, Gender, and Admission Status—so we’ll need to use some more advanced calculations to deal with the fine grain of the data. Here are the steps to build the above Marimekko chart:

1. Start with a crosstab to help validate values. Place the x-axis dimension(s) that will drive the Level of Detail as discrete pills on Rows. Then add to its right the discrete pill that will be used for the Color shelf:

2. Add the initial measure of interest, in this case SUM(Applicants) to the Text shelf.

3. Create the y-axis measure using the percent-of-total quick table calculation. In this case, we’re using the Applicants measure with a compute-using option on Admission Status.

4. Double-click on Measure Values in the Measures window. Tableau will create a Measure Names/Values crosstab and show the Measure Values card.

5. Drag the initial measure of interest (Applicants in this case) from the Measures window to the Measure Values card.

6. Now we’ll generate the size (width) of each Marimekko column. In this case, we’ll use make a calculated field using a Level of Detail (LOD) Expression because it saves us from the complications of table calculations.

The formula for the Applicants per Column measure is {EXCLUDE [Admission Status]: SUM([Applicants])}. This way, it will sum up all the Applicants for each combination of Department and Gender, and the result will be the column width that we need. Drag this to the Measure Values card.

7. Now we need to create the x-axis position of each column. To do so, we need to answer two questions. First, are we going to have this measure determine the left or right edge of the column? In this case, we’ll use the right edge because it’s easier to calculate.

Second, how do we get the same value for each mark (created by the Admission Status dimension) in each column (created by the Department and Gender dimensions)? Now, it would seem that all we need to do is generate a running total of the Applicants per column measure.

However, for Tableau’s running-total quick table calculation, there’s no compute-using setting that will reliably work no matter the data structure (particularly when it comes to sparse data). So we have to build our own.

There are a few ways we could do this. I think the following calculation is the easiest to use since it gets the desired results in a single calculation. Here’s the number-of-applicants formula. The calculation has a compute-using on specific dimensions: Department, Gender, and Admission Status (in that order):

IF FIRST()==0 THEN

MIN([Applicants per Column])

ELSEIF MIN([Department]) != LOOKUP(MIN([Department]),-1) THEN

PREVIOUS_VALUE(0) + MIN([Applicants per Column])

ELSEIF MIN([Gender]) != LOOKUP(MIN([Gender]),-1) THEN

PREVIOUS_VALUE(0) + MIN([Applicants per Column])

ELSE

PREVIOUS_VALUE(0)

END

Here’s how it looks in the workout view:

This formula of the # of Applicants field is a bit complicated. Here’s how it works:

a. If it’s the first address (aka row in the partition) then return the Applicants per Column.

b. If there’s a change in the Department or Gender from the prior address (i.e. we’re in a new column), then return the sum of the prior value of this measure (from the prior address) plus the current Applicants per Column. This increments the running sum for each new Department or Gender.

c. If there’s no change in the Department or Gender, then return the prior value of this measure (from the prior address). This carries forward the running sum across the Admission Status without incrementing the running sum so all Admission Statuses in the same column will have the same value.

Note that when adding the pill to the view and setting up the addressing on specific dimensions, Tableau 10 automatically picks up the order of the dimensions on Rows that we defined in step 2:

This is a new default behavior in Tableau 10. In prior versions, the order in the equivalent dialog was alphabetical, and sometimes that led to incorrect addressing. Thanks, Tableau!

Now, with this visually validated, we can build the Marimekko chart view.

8. Duplicate the workout worksheet.

9. Change Measure Values from Text to the Level of Detail shelf. The values in the view will be replaced by Abc’s.

10. Remove Measure Names from Columns. Tableau will now draw overprinted Abc’s.

11. Move Department, Gender, and Admission Status to the Level of Detail shelf (in that order). Tableau will change the view to be a bunch of square marks.

12. Move the SUM(Applicants) percent-of-total quick table calculation pill from Measure Values to Rows. The view will now have a single stacked bar.

13. Move the # of Applicants measure from Measure Values to Columns. Tableau will create a scatter plot.

14. Change the Marks type to bar. You will now have lots of bars:

15. Move the ATTR(Applicants per Column) measure from Measure Values to the Size shelf. Besides applying the size and creating a legend, Tableau will automatically remove Measure Values and put the SUM(Applicants) Measure on the Level of Detail.

16. Click on the Size shelf and change the setting to “fixed,” with alignment set to right.

This new fixed control in Tableau 10 is telling Tableau to use the values from the pill on the Size shelf to set the width of each bar segment. The alignment set to right is telling Tableau each each bar segment will extend from the right edge of the segment, where the segments are positioned based on continuous pill (the # of Applicants table calculation in this case) on Columns.

You should now see an uncolored Marimekko plot:

If your Marimekko doesn’t have all the bars stacked vertically and horizontally at this point, then refer to these troubleshooting tips before proceeding.

17. Set Admission Status to be on the Color shelf.

18. Set Gender to Label.

19. Edit the tooltips and turn off “include command buttons.” (For this kind of view, we don’t want users accidentally filtering data and breaking the chart.)

## Comments

Nice job - been struggling with it. And this helps to explain the more advanced flavors that are possible. Thank you.

Thanks, Berthold!

Can you just hire someone from Mekkographics or Thinkcell and make this easy

This just saved me - prior attempts at Mekko charts in Tableau required unions and custom SQL and I still couldn't make it work. But this? This. Is. Brilliant. And easy to follow and understand. You're my hero.

@Shannon - Yes, Tableau 10 definitely made it easier compared to the replicated data and polygon-drawing in previous versions!

Hi Felicia,

Sorry for the late reply on this, if you are still looking for help email me at jonathan (dot) drummey (at) gmail.com.

Jonathan

This was great and I was able to follow the instructions to successfully build the Mekko. However, I want to show the X axis (in this case, # of Applicants) as as percent too (% of total number of applicants). However, since there is already a table calculation in the field, I am not sure how to do this. Any advice?

Hi Jonathan, thanks for the detailed tutorial. I love it! I've tried to recreate your work - my crosstab is correct but when I try to crate the chart, my Y-axis does not go up to 100% (the sum of the individual columns adds up to 100%) - the highest mark is 34% which represents the % of the column in the table. I've tried futzing with the calculations but no luck. Any thoughts on how to troubleshoot? Thank you!

Is there a way to make a similar marimekko chart with horizontal bars instead of vertical? I've been trying to do it by flipping some of the instruction above but it's not working. Any suggestions?

@Jeff - when there are continuous pills on Rows and Columns (as in the marimekko) the bar marks are stacked vertically by Tableau without any extra effort while we use calculations and the bar mark size option to get the horizontal stacking. So the calculations would need to be significantly flipped to accommodate this change. If you want any help please email me at jonathan (dot) drummey (at) gmail.