Alteryx Designer Desktop Discussions

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

If Then Statements Overwriting Other Formulas

greenman73
7 - Meteor

Hi there,

 

Having an issue where i have 3 If, then statements using the Formula widget and i am trying to add a day count to a row based on a word from a cell within that same row.  If i run them individually the days load as expected but when i run all 3 together the days are wiped out completely.  If if i create 3 different formula widgets in a row in the design chain each step overwrites the other.  Not sure what i am doing wrong here as i have never experienced this before with other if, then statements.

 

Attached are the formulas.

 

thanks

Jonathan

10 REPLIES 10
alexnajm
16 - Nebula
16 - Nebula

Based on your configuration, this makes sense - you are saying to only evaluate one of the statuses at a time, and saying if it doesn't meet this status then make it Null... they'll execute one after the other so anything you did before for previous statuses will be made null.

 

You can either write it all in one statement, or you can change the ".ELSE Null()..." to just "... ELSE [SLA]... so that it keeps the original value!

aatalai
13 - Pulsar

They are overwiritng because each are to the same column, is that correct, do you want all of these to be outputted in one column?

aatalai
13 - Pulsar

Try this

 

If contains ([incidents stauts],"resolved") then datetime diff ....

 

elseif  contains ([incidents stauts],"closed ") then ...

 

 

elseif  contains ([incidents stauts],"in proress ") then ...

 

else null() endif

greenman73
7 - Meteor

Yes they are all in the same column.  

aatalai
13 - Pulsar

Ok @greenman73 then use the formula with elseif mentioned by @alexnajm and myself, let us know if that works

AmitMiller
Alteryx
Alteryx

Hi @greenman73, if I understand correctly - your logic is to create the DATEDIFF in the SLA column - if one of the 3 values (resolve, closed, in progress) is found.

What's interesting - is that your DATEDIFF function is the same for all 3 values.

If that is indeed correct - then you can utilize the IN() function - and write the DATEDIFF function only once:

Screenshot 2024-02-13 at 15.29.36.pngI've included both versions of the IF function (IF-THEN-ELSE and the shortened IIF())

See Workflow attached.

 

Hope that helps!

greenman73
7 - Meteor

thank you!!!

cmunezero
5 - Atom

Hi There, 

Could you help me to fix an error with "If Statement"? I have three columns and I want to create a fourth column whose values should be the values in the first column. However, if that first column is null, then I should use the values of the second column and if the second column is null, then I should use the value of the third column. And if all the three columns are null, then the fourth column should also be null. 

 

I have been trying to use this formula: 

 

Field4 = 

If isNull([Field1])

then [Field2]

elseif isNull([Field2])

then [Field3]

else 'Null'

endif

 

I feel there is a simple adjustment that I am missing and that is making my formula wrong. I would appreciate any help. Thank you!

alexnajm
16 - Nebula
16 - Nebula

@cmunezero I would recommend starting a different thread as this one will not go to the broader Community. However I also can't answer your question as I don't know what the "error" is that you are referring to - that structure looks correct overall.

Labels