Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to handle the Precision Lost Error

danielkresina
9 - Comet

I'm trying to load some data from CSV files that have numbers with very high precision.  Due to other reasons, I have to load the data as text fields and then convert it to numbers in my workflow.  Whenever I try to convert the string values to numbers, I get a warning at runtime that the numbers "had more precision than a double. Some precision was lost."  This occurs no matter what numeric datatype I try to use.

I'm fine with rounding these rediculously precise numbers, but I'd like to supress the warning message somehow.  I tried explicityly using the ROUND function, but that doesn't work since I need to convert the text to numbers anyway before the round function can be used so I still get this error.

rtaImage (5).png

Any ideas?  Thanks.

18 REPLIES 18
AdamR_AYX
Alteryx Alumni (Retired)
The ToNumber function in the formula tool has an optional second parameter which is bIgnoreErrors.

So a formula like so

ToNumber(StringField, 1)

into a new field of type double should do the trick

Cheers
Adam
Adam Riley
https://www.linkedin.com/in/adriley/
danielkresina
9 - Comet
Thanks Adam, that worked great.  I forgot about that handy "IgnoreErrors" option.  In case other users want more details, I wrote up a quick blog post on this.  http://sculptingdata.com/alteryx/converting-data-types-in-alteryx/
cbridges
11 - Bolide
I have a follow up question. My data is already in number format, but I went ahead and used ToNumber in order to specify the decimal precision by changing output to Fixed Decimal (30.15). It works fine until it hits points farther along in my flow, when I again receive the error "XYZ had more precision than a double. Some precision was lost." What's really weird is that I used the "1" to suppress those messages. It's like Alteryx "forgets" what format the number is...any thoughts?
@thizviz
danielkresina
9 - Comet
cbridges, when you say your data is in number format, what's the exact number format?  If you put a select tool in your data stream, what data type does it show for that field?

If your goal is to just change the decimal precision, you may want to use the round function directly.
cbridges
11 - Bolide
One of the fields is Double and one is Int32
@thizviz
cbridges
11 - Bolide
One of the fields is Double and one is Int32
@thizviz
cbridges
11 - Bolide
That's according to the select tool. I know that the double is a currency field, so it's ###.## and the other is units, so that's just a regular integer. But, at some point down the line I have to do some fancy math with both of them, multiplying them by a number with up to 15 decimal places. At that point, I convert the fields to fixed decimal 30.15.
@thizviz
danielkresina
9 - Comet
Ok, would it be possible to round the numbers at the point where you do the multiplication?  You could wrap the multiplication function with the ROUND function at that point.

Feel free to send a sample if you'd like and I can take a look.  danielkresina at tabsgroup.com
cbridges
11 - Bolide
Thanks Daniel, I'll give that a try. I've been trying to avoid rounding in Alteryx so I can allow Tableau to round the results at whatever level of aggregation I need. But right now my numbers are off, so it's worth a shot! I would have to do some anonymizing to send a sample, but I think if I don't have it worked out in the next day or so I'll check with support. Thanks again for your tips!
@thizviz
Labels