Today we will be looking at combined fields and data splits within Tableau.

 

Should you for some inexplicable reason decide that you desire a combined field in Tableau, I would advise you close your laptop, pour yourself some coffee and have a long hard think about it. If you still decide you want it, other than to do the “Combined Fields Sort” from the last blog post (which is obviously a great reason for it), then this is how:

Please bear in mind that the explanation here is the same from the last blog post, it’s just in case someone hasn’t read that yet, the heathens! – All you have to do, is double click in white space on either the row or column shelf, start typing your first field, say “Region”, and then add a plus sign “+”, throw in a delimiter so that the two words are not joined at the hip, such as “-“ (the quotation marks need to be in this one), then another “+”, and finally the second value, say “Sub-Category”, and hit enter. If you want to save this field for further use later on, drag it to the data pane and give it a suitable name. Done.

 

The reason I protest to this silly little function so much, is that I cannot think of a single instance where I cannot achieve the same result without just dragging the Region and Sub-Category fields into the same shelf and just have them sit next to each other.

If you can think of a better use for this function beyond the Combined Fields Sort from the last blog, please feel free to enlighten us.

 

Ok, now that is out of the way, what do you do if you open up a dataset and find that there is a combined field already in there!!! Do not fret, not everyone is as logical as you or I when it comes to data, and predicting this lapse in judgment, Tableau has a Split function!

Now you need a delimiter between the two values you want to split, be it a space, a comma, a hyphen, and so forth. So for this example, I am going to take the opportunity to split up the abomination we created above.

It’s very simple, first right-click on the aptly named “StupidCombinedField” scroll down to where it says “Transform” and choose “Custom Split”.

 

In the “Use The Separator” box type “-“, ignore the confusing ghost images, they are not really there. Then edit the “Split Off” choices accordingly. “First” will separate out the “Region” value, “Last” will separate out the “Sub-Category” value, and “All” will unsurprisingly break them all up. The “Columns” option is useful when you want to break up a combined field with more than two values in it.

 

 

That’s it for today folks!