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

Conditional function question

stphnwl
7 - Meteor

Hi All,


First post here.

 

I'm trying to write a simple conditional statement that will convert anything greater than 12 into simply 12. Here's what I have, but I'm receiving an "Invalid type in operator >." error. Could anyone please advise?

 

IF [total_months] > 12 THEN 12 ELSE [total_months] ENDIF

 

Thanks!

2 REPLIES 2
NicoleJohnson
ACE Emeritus
ACE Emeritus
It's likely that your field type for [total_months] is something other than a numerical type.

Try this: IF ToNumber([total_months]) > 12 THEN "12" ELSE [total_months] ENDIF

Alternatively, if you put a select tool in front of your formula tool and change the field type for [total_months] to a numeric format, then you can leave your formula as is!

NJ
stphnwl
7 - Meteor

Thanks, NJ.

 

I was actually about to post that my data was still in V_WString! You're quick!

 

Thanks a bunch for the additional formula education.

Labels