Tableau Quick Tip: Create a Gap in Tabular Reports

Ever design a table in Tableau and wish you could insert a gap between columns or rows? Maybe you want to show several values, but set one apart from the others. Something like this:

Gap in Columns

Or maybe you want to create some space between categories, like this:

02 Gap in Rows

Whatever the reason, in some cases, it’s actually quite easy. Assuming that you are using Measure Names / Measure Values to define the rows or columns, all you need is a Measure that gives you the “gap”.
You might think to use a blank string (e.g. “”), but even as a measure (e.g. MIN(“”)), that can’t be added to the Measure Values shelf which only takes numeric values.
You might use NULL, but by itself you can’t add that to Measure Values either. The trick, is to cast NULL as a numeric value. So create a calculated field with the code:

That tells Tableau to have a null value, but the type is integer. Now you can add it to Measure Values and get the gap you want:

In this view, the field is named Null Gap, but has been given the alias of a single space so the header is blank (right click the header and select “Edit Alias” or use the drop down field on Measure Names to edit all aliases). Alternately, you could simply have named the field with a single space.

And finally…

  • Want to see the workbook in action or download it? It’s here!
  • Not so fond of text tables and want to transition your boss / client / yourself to something more visual?  Check this out!

Hope this helps!

4 Responses so far.

  1. Matthew says:

    This is brilliant, and thanks for sharing. INT(NULL)… I’d have never thought of that. I’m a bit torn as to whether this is one of those “Wow, look how flexible and data-driven Tableau is!” features, or another “Why did I need a hack to do this? Why are simple things sometimes so hard?” workaround.

    • benmelek_admin says:

      Yeah, I know what you mean. This is a case where I think it’s a data driven design and you can leverage that to get the flexibility you need.

  2. John says:

    I was excited to see this hack, but for some reason my null gap is still showing up as “0”. I can’t figure out what makes your set up different. Have you seen this and can diagnose without seeing the set up?

    • Joshua Milligan says:

      I’m not entirely certain. Some possibilities are

      • certain visualization types might default to a 0 value
      • if you are blending, you might get some unexpected behaviors
      • ensure that you are using INT(NULL) and that it isn’t getting wrapped in some other calculation or aggregation that might change it to a zero – e.g. ZN()

      If you happen to have a screenshot somewhere that shows the field locations on the shelves, I’d be happy to take a look!

Leave a Reply

Your email address will not be published. Required fields are marked *