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

if then else to create new column

hash9
7 - Meteor

My input data is

 

PositionLength
231
242

 

I want to create another column which should be

PositionLengthColumn
231 
24225

 

if the length is "2", then it has to take this column "Position" and add 1. If it is 1, then leave it blank

 

I tried using if the clause, but i'm getting an error(Type mismatch in operator "+")

IF [length] = "2" THEN [position] + "1"
ELSE Null()
ENDIF

 

Can someone pls help me fix this?

 

Thanks!

 

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

Did you try...

 

IF [length] = 2 THEN [position] + 1
ELSE Null()
ENDIF
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
WillTravelForData
8 - Asteroid

I used the formula

 

IF [Length]=2 THEN [Position]+1 ELSE Null() ENDIF

 

in the attached workflow to populate the new column.hash9.PNG

hash9
7 - Meteor

I tried and it worked. Thanks a lot

Labels