Tony
Tony

Reputation: 9621

Tableau Decimal to String

I have a field which is a Number(decimal) here's one such example value:

1005.44

now if I try to convert that to a string to simply get me what is seen; I'd expect STR = 1005.44

but instead I get:

1005.4400000000001

thats from STR(ROUND(([FIELD]),2))

I see some other posts with similar issues but no found resolution?

Upvotes: 0

Views: 633

Answers (1)

tagyoureit
tagyoureit

Reputation: 1286

This artifact isn't unique to Tableau and stems from how underlying databases store floating point numbers and deal with functions like rounding.

You should try the following: str(int([FIELD]*100)/100)

This will multiply the number by 100, convert to an int, divide by 100, and then convert to a string.

Upvotes: 1

Related Questions