Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Conditional IF statement to take last true condition if multiple are true

cmnflom
6 - Meteoroid

Hi All,

 

I have long IF statement runs through several conditions and assigns a value for each condition.

 

For example:

IF stockroom = 6 AND inventory < 0 THEN "Stockout"

ELSEIF PO_category = "Past Due" THEN "Past Due PO"

 

The issue I'm having is that although multiple conditions may be true for a row, it takes the first true condition and then moves on to the next row. Is it possible to structure the IF statement in a way that it takes the last true condition as opposed to the first?

 

Thanks!

 

 

 

 

2 REPLIES 2
atcodedog05
22 - Nova
22 - Nova

Hi @cmnflom 

 

IF Else Statement follows top to bottom flow so if the first condition is true then it won't check the next conditions similarly first and second is true it takes second and won't check the rest the flow goes in a similar way. And it is not possible to change it to bottom to top flow you need to structure your conditions so that it follows top to bottom flow.

 

Hope this helps : )

Ben_H
11 - Bolide

Hi @cmnflom

 

Instead of putting all your conditions in one long IF couldn't you do each part in turn as separate formulas, kinda like this -

 

Ben_H_1-1635348942813.png

 

Any new conditions that are met would overwrite the previous values, otherwise it just keeps whatever was put in there by the previous result.

 

Ben_H_2-1635349029798.png

 

Does that make sense?

 

Regards,

 

Ben

 

Labels
Top Solution Authors