Digging into Unions in Tableau
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 1||Col 2||Col 3|
The first sheet I created ‘Col’ looked like the above.
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!