Currently I have set 2 decimal points for a field in worksheet.
My requirement is - I want to see decimal points only if a value has decimal points, but if it doesn't then decimals should not show up at all.
For e.g. If a value is 0.05 then it should be displayed as "0.05", but if it is 100 then it should be displayed as "100" and not "100.00"
Hence I want decimal values to be 2 at times when it has a decimal value, but it should be 0 when it doesnt.
Is there any way I can do that? Any way I can write a code in Format option to handle this
Hi Romil. Are you just displaying the value as a label? If so, you could use a calculated field to convert the value to a string and parse the string. The formula would be similar to this:
IF FIND('.',STR([value]))>0 AND RIGHT(STR([value]),1) <> '0'
ELSEIF FIND('.',STR([value]))>0 THEN LEFT(STR([value]),FIND('.',STR([value]))-1)
Become a Viz Whiz on the Forums!
Support the Community and master Tableau.
Retrieving data ...