1 of 1 people found this helpful
Hi Young, you can use ASCII to convert the first character to numeric (assuming you are talking about characters in the ASCII range). The first lowercase letter ('a') is 97, so checking for a value less than 97 allows you to distinguish between upper and lower case.
You can use a calculation such as this to uppercase the first letter:
IF ASCII([field]) < 97 THEN UPPER(LEFT([field],1)) + MID([field], 2) ELSE [field] END
But you can make this even simpler since you don't even need to do a comparison, you can always convert the first letter to upper case:
UPPER(LEFT([field],1)) + MID([field], 2)
Hi Jeff, that is certainly one way I could tackle this issue.
Just curious, is there any features currently in the latest version of Tableau that circumnavigates the need to look up the ascii table?
Actually, scratch what I just asked...should have thoroughly read your reply.
Hi Young Song,
The following methods can be used to covert First Letter of String to Upper.
If you are getting the Data from Oracle to Tableau, We can use Function initcap at Oracle level.
I mean we can import before get the data into Tableau.
We get the result as First Letter Upper case, Irrespective what case it has.
upper(mid([Field], 1,1) ) + mid( [Field], 2, len([Field])
If you want to check whether first character is either Upper or Lower, we can use ASCII function as Jeff D shared the solution.
just needed 1 extra ) on the end of that calculated field there.