Calculated Field is giving me randomly rounded data when used in Tableau (1 Viewer)

Cark

Registered User.
Local time
Today, 06:17
Joined
Dec 13, 2016
Messages
153
I have a field called "SI" which is calculated by adding up various terms based on doing IIf(X="Y",[some number like 0.75 here]). The expression eventually gives me a decimal number for example one row's value of SI would be 0.65+0.22+0.7+0.12 = 1.69.

I have set up the formatting for this field as:

  • Calculated
  • Result Type: Decimal
  • Format: General Number
  • Precision: 18
  • Scale: 0
  • Decimal Places: 6

Inside my database, these values look perfect for how I think the decimals should look, but when I import this data into Tableau, Tableau does not aggregate (add up) these values correctly and I have a feeling it is something to do with the formatting of the numbers.

I extracted the calculated field of Severity Index and pasted the values into a completely fresh database with the following settings:

  • Number
  • Field Size: Decimal
  • Format: General Number
  • Precision: 18
  • Scale: 3
  • Decimal Places: 6

And it worked perfectly. From this I seem to think Scale going from 0 to 3 is what is making it work. When I try changing Scale from 0 to 3 in the calculated field however, it does not save the change and when I save the table and reopen it, it reverts back to 0.

Anyone know how to go about solving this?

Let me know if you need any more information.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 23:17
Joined
Jan 20, 2009
Messages
12,851
A Decimal datatype is stored as an integer with a scaling factor. Precision is the number of significant digits and Scale is the number of digits after the decimal point.

Tableau probably doesn't understand this datatype. (There were times when Access didn't even understand it very well.)

Try using Double instead.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:17
Joined
Feb 19, 2002
Messages
43,223
Currency is actually better as long as you don't have any more than 4 decimal places. Do not confuse the currency data type with the currency format. the Currency data type can be formatted however you want it to be.
 

Users who are viewing this thread

Top Bottom