Alteryx Designer

Find answers, ask questions, and share expertise about Alteryx Designer.

Converting a v_string to a number in an IF, THEN, Else Statement

6 - Meteoroid

What's the proper syntax for this statement......IF [Quarter] = "Q1" THEN ToNumber[% of FY]* [PYABA] ELSE " " ENDIF


Te [% of FY] field is a v_string data type....


I would just change the Else.  Since this is set up to be a number based on what I see, but the Else would be a string.  Also missing the () around the tonumber()


Options (changes in bold):

Make it a string

IF [Quarter] = "Q1" THEN tostring(ToNumber([% of FY])* [PYABA]) ELSE " " ENDIF


As a number

IF [Quarter] = "Q1" THEN ToNumber([% of FY])* [PYABA] ELSE 0 ENDIF

or if you don't want zeros you can use nulls

IF [Quarter] = "Q1" THEN ToNumber([% of FY])* [PYABA] ELSE null() ENDIF  


The final option is to just change the [% of FY] to a number with the Select tool before the Formula.


Hope this helps.


Scott Jones
Strategic Sales Engineer
Alteryx, Inc.