When adding colour to a Square mark type in Tableau the colour can spill out of the cell, covering other adjacent cells. Why this happens I don’t know.

An example is below. Hover over the cells and check the tooltip. There is a difference between the Square and the Gantt mark types. The tooltip of the Square mark type cells doesn’t always show the data of the selected cell.

When using the placeholder technique to build a table it is common to use the Square mark type. For example Tableau Heatmaps are tables using the Square mark type.

A previous article describes building Tableau tables using the placeholder technique and the Square mark type. The article included a method to resolve the colour overspill; duplicating the dimension.

Here I will show how to format a table using the Gantt. It is almost identical to using the Square mark type, only there is 1 additional step.

To quickly recap:

  1. Create a Placeholder calculated field with the formula MIN(0)
  2. Put the Placeholder on Columns
  3. Change the mark type to be Square
  4. Put the measure to be displayed on the Label shelf – Profit was used in my example
  5. Put the measure to colour on the Colour shelf – Profit was also used here but could be another measure such as YoY change
  6. Increase the Size to the maximum, which should mean the entire cell is filled with the colour

This may cause the colour to spill out from the cell. Using the Gantt mark type is one way to rectify that. (An alternative “dimension duplication” technique was covered in the article about building Tableau tables.)

Using the Gantt mark type is close to the same as above with a few small changes. Firstly #3 will change to a Gantt mark type.

Number 6 will also change; use a calculated field on the Size shelf instead of manually adjusting the width. Create a new calculated field with the formula MIN(1). This field will always return a value of 1. To finish place this new field on the Size shelf.

Hover over the cells and check the tooltips. There should be no overspill with the gantt mark type.

In the image the Gantt placeholder is displayed; the highlighted bars against the placeholder how the mark type. The additional dual-axis placeholder fields are included for formatting purposes.

Download the workbook comparing Square and Gantt mark types from Tableau Public to see how it is all put together.