Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Formula Dividing a number not getting expected results.

Jay_dup_148
7 - Meteor

I am on version 2018.2 

 

I have a simple formula where I am dividing 1 number by 100 and comparing it to another number. It works most of the time, but sometimes I get answers I don't expect. I suspect is has to do with the datatype precision, but It doesn't appear I can use fixed decimal fields in the formula. I've attached an example below.

 

Let's say I have Field one and Field2 with the following values

.074 7.4
.094 9.4

 

and the formula

 

If [Field1] = [Field2]/100
then 1
else 0
endIF

I would expect both to be one, but the first row returns 0.

How do I get around this?

1 REPLY 1
NicoleJohnson
ACE Emeritus
ACE Emeritus

I expect it has something to do with rounding and the double field type... try adding this to your formula (appears to work for the examples provided):

 

If [Field1] = round([Field2]/100,0.001) then 1 else 0 endIF

 

This will round your Field2/100 value to the thousandths. To be safe, you could also add the rounding logic to the Field1 value. This will round your values to the same decimal place to ensure matches at that decimal level.

 

Cheers,

NJ

Labels