1 Reply Latest reply on Nov 8, 2019 12:12 PM by Subodh Gupta

# Handling the Decimal in Tableau

Hi All,

I have a different scenario here, my user want to see the percentage for all his data except 100 and 0, we got that by writing case statement. but if my data have 89.70 in DB, when it comes into Tableau it is showing as below but user want 89.70%.

Is there anyway to count(length) of the numbers after "."(dot). here is the example. 89.7 is 4 character (length) if we are able to find length after decimal then we can concatenate with 0.

for the same example 89.7, after decimal length is 1 then we can concatenate with zero then we will get 89.70

for this example 74.24 after decimal length is 2 then we no need to concatenate with Zero, so is there any way to find the length after decimal? please let us know,. Thank you. • ###### 1. Re: Handling the Decimal in Tableau

Hi,

You can do LEFT (SPLIT(STR([Fieldname]),'.',2) + '00' ,2). This will pad a zero to the field if there is only one digit after the decimal.

You may or may not need the STR, depending on the datatype of your field.  The SPLIT will split on '.' and take the 2 part of the string, '+' will concatenate it with '00' and then LEFT will take the 2 left characters.

Then you can append it to SPLIT(STR([Fieldname]),'.',1)

1 indicates the part before the decimal.

Subodh.

1 of 1 people found this helpful