Alteryx Designer Desktop Discussions

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

Formula question

tpostlewate
7 - Meteor

I have two columns, one is 'estimated' age and one is 'exact age'. I want to create a new column 'New Age' where if 'exact age' is populated, it moves that age into the new column and if exact age is NOT populated and 'estimated age' is, it moves 'estimated age' into the New Age column. I hope that makes sense. Thanks in advance!

11 REPLIES 11
Emil_Kos
17 - Castor
17 - Castor

Hi,

 

I have prepared a workflow for you:

 

Emil_Kos_0-1609337973960.png


If this is helpful for you please mark my post as a solution!

 

If this isn't the exact output please provide us with more details. 

 

 

AkimasaKajitani
17 - Castor
17 - Castor

Hi @tpostlewate 

 

You can use Formula tool.

 

Input : 

AkimasaKajitani_0-1609338012663.png

 

 

The expression is the below.

IF IsEmpty([exact age]) THEN [estimated] ELSE [estimated] ENDIF

 

Output : 

AkimasaKajitani_1-1609338038010.png

 

 

Is this helpful?

 

tpostlewate
7 - Meteor

Okay, I tried that:
IF IsEmpty([exact age]) THEN [estimated age] ELSE [estimated age] ENDIF

 

and it filled in 0 if there was an exact age present and a -1 if there was an estimated age (There won't ever be both an exact age and and estimate age, it will always be one or the other), so I did something wrong. 

Emil_Kos
17 - Castor
17 - Castor

Hi @tpostlewate,

 

Please try this

 

IF IsEmpty([exact age]) THEN [estimated age] ELSE [exact age] ENDIF

 

This formula will show estimated age if exact age will be empty. If exact age will not be empty it will show it as a value. 

tpostlewate
7 - Meteor

This is still giving me 0 and -1 in the New age field. 
IF IsEmpty([exact age]) THEN [estimated age] ELSE [exact age] ENDIF

 

 

 
 

 

 

 

Emil_Kos
17 - Castor
17 - Castor

Hi @tpostlewate,

 

I am not sure why is that. Maybe you need to change the data type to double? 

 

Emil_Kos_0-1609340352358.png

 

tpostlewate
7 - Meteor

For some reason, I cannot open the workflows. 😞

Emil_Kos
17 - Castor
17 - Castor

Hi @tpostlewate,

 

Can you advise which alteryx version you have? 

tpostlewate
7 - Meteor

I tried that and it didn't like it. It says : The formula "New age" resulted in a string but the field is numeric. Use ToNumber (...) if this is correct.

Labels