# Alteryx Designer Discussions

'Tis the season to be spooky! Read our new blog, How Spooky is Your City? Mapping and Predicting Scary Stuff. In it, @SusanCS provides a fun glimpse into using data to figure out the creepy quotient of where you live!

SOLVED

## If And Statement with Diffrent Parameters and Error

Highlighted
5 - Atom

Can someone take a look at this and tell me what I may have missed, my apologies I am new to Alteryx.

IF [OPTION]="Option 1" and [Amount of Sales]<="499.99" and [DATE OPEN]<="2016-08-31"  Then "9.95"
ELSE "NOTHING"
ENDIF

Error I am receiving says "The formula "billing" resulted in a string but the field is numeric. Use ToNumber(…) if this is correct.

Option column is Text

Date open is converted to Alteryx date

Amount of sales is "Double"

Highlighted
Alteryx Certified Partner

Hi @CSIMO ,

You have three problems in your statement there:

IF [OPTION]="Option 1" and [Amount of Sales]<="499.99" and [DATE OPEN]<="2016-08-31"  Then "9.95"
ELSE "NOTHING"
ENDIF

Since [Amount of Sales] is a number, you can use 499.99 only, without quotes.

For dates, you can't compare using < or >, in that case, you need to use the DatetimeDiff function, as below:

DatetimeDiff("2016-08-31",[DATE OPEN],'days')>0

The formula is doing "2016-08-31"- [DATE OPEN] , so if this value is higher than 0, the clause is doing the same as you are.

best,

Fernando Vizcaino

Highlighted
5 - Atom

Thank you Fernando for the reply, I am still seeing the same error. Have I made the corrections correctly Below?

IF [OPTION]="Option 1" and [Amount of Sales]<= 499.99 and DateTimeDiff("2016-08-31",[DATE OPEN],'days')>0 Then 9.95
ELSE "NOTHING"
ENDIF

Highlighted
Alteryx Certified Partner

One more detail then. Maybe you formatted the Data Type of the column [billing] as numeric

Best,

Fernando V.

Highlighted
5 - Atom

I think I am home thank you Fernando, I had to also change the 'Data Type' to String

Labels