1 of 1 people found this helpful
in Tableau you can use String functions to split the field based on the comma separation
The problem is going to be that sometimes the 2nd value will be Country and sometimes State.
You could first count the number of delimiters, then if its 2 (i.e. State, Country) do one thing and if 3 (County, State, Country) do something else...
This link has a really good library of string functions (you'll want nearer the bottom, maybe 34 on-wards)
Time permitting, I'll see if I can start you off
There may be a better way.
I created four splits on your string. Then four more calculated fields to determine when to use each of the four splits. You might have to tweak a bit, but it looks like it is working on your sample. I added one for City too.
9.2.4 workbook attached.
stringtest.twbx 55.4 KB
This just might be the ticket - thank you! I'll play around with this a bit. If I come across any issues I'll reply back but if not, consider this resolved.
Sure. I noticed that even though the splits might appear to be null, T doesn't think it is null. That is why the formulas reference "" vs. IFNULL(). And, it is putting a space in front of some of them so you might want to wrap the functions in LTRIM().