Digging into Unions in Tableau

17 April 2019

A question we had internally recently was whether Tableau's union function was by position or by field name. The ability to Union data together was brand new in Tableau Desktop 9.3

A union is where you would add additional rows by effectively putting two data tables on top of one another. Tableau's help guide has a nice way of visualising this.

The best way to find out how Tableau was doing this by default was to test it using our good friend and ally, Excel.

Col 1Col 2Col 3
HelloFromThe

The first sheet I created 'Col' looked like the above.

123
HellooooFrommmTheee

The second sheet, imaginatively named 'Sheet2' was like the above. Note the different header names, to see whether it does match by name or by position.

As you can see above, the union matches by field name, so our two sheets did not match.

However, should you wish to match them by position, not field name, if you right click > 'Generate Field Names Automatically', Tableau creates dummy headers (F1, F2, F3 etc) and unions them by position!

Thanks for reading!

Author:
Ravi Mistry
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Information Lab and data industry
Subscribe now
© 2024 The Information Lab