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:
Or maybe you want to create some space between categories, like this:
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.
- 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!
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.
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.
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?
I’m not entirely certain. Some possibilities are
If you happen to have a screenshot somewhere that shows the field locations on the shelves, I’d be happy to take a look!