Alteryx Designer Desktop Discussions

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

Nested if

praneshsapmm
8 - Asteroid

Hi,

 

I have 3 formulas  that needs to be executed in sequence to find the value fo LT  

 

1. If AD-DD < 0 then SD-DD else AD-DD

2. If SD-DD < 0 then ED-DD else SD-DD 

3. If ED-DD<0 then '1' else AD-DD 

 

If tried to use If and Else if , but its not working . Can some help to build this in one queruy. 

 

Thanks

5 REPLIES 5
ShankerV
17 - Castor

Hi @praneshsapmm 

 

Please try this below in 3 different formulas.

 

If AD-DD < 0
then SD-DD
else AD-DD
endif

 

If SD-DD < 0
then ED-DD
else SD-DD
endif

 

If ED-DD<0
then '1'
else AD-DD
endif

 

ShankerV_0-1677829291662.png

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @praneshsapmm 

 

You can try this also.

 

If AD-DD < 0
then SD-DD
ELSEIF SD-DD < 0
then ED-DD
ELSEIF ED-DD<0
then 1
else AD-DD
endif

 

But point to be noted, if the condition 1 is satisfied then it will not check the condition 2.

 

As per the business requirement, need to know what is the expected output if both AD-DD < 0 and ED-DD<0,

 

Many thanks

Shanker V

 

praneshsapmm
8 - Asteroid

hi @ShankerV ,

 

I tried to build this in one query , but if it meets first condition , loop ends there , i want it to check the other condition as well . 

 

I do not want to create too many formula so try to meet the reqiurements in same query .

 

Thanks

ShankerV
17 - Castor

Hi @praneshsapmm 

 

Can you share the sample input and expected output.

Based on that, can modify the function.

OllieClarke
15 - Aurora
15 - Aurora

Hey @praneshsapmm I think this is what you want:

IF [AD-DD]<0 AND [SD-DD]<0 AND [ED-DD]<0 THEN 1

ELSEIF [AD-DD]<0 AND [SD-DD]<0 THEN [ED-DD]

ELSEIF [AD-DD]<0 THEN [SD-DD]

ELSE [AD-DD]

ENDIF

 

Hope that helps,

 

Ollie

Labels