Alteryx Designer Desktop Discussions

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

Multi-Row conditional code

DanielDoyle
5 - Atom
Hi there - I know this should be simple but I cannot figure it out!
 
I'm am trying to do a simple if statement where it looks at line 1 and then next row and if the ref is the same but the month fields is different then highlight this fact by updating column x for example
I am trying to use a Multi-Row 
 
using the code 
 
IF [Sysref]=[Row+1:SysRef] and [DateTime_Out2]=[Row+1:DateTime_Out2]then "Ok"
else "NotOk"
endif
 
Which returns all the ok ones which is correct - but how do I isolate all of the records where the Ref is the same but them month is different ? I cannot seem to figure out nested ifs...
 
So what I want:
 
If ref1 = ref2 then
if month1 = month2 then
"Ok"
elseif month1 not equal to month2 (but ref1 is equal to ref2)
"Not Ok"
endif
end if
 
Am I making sense ?
 
Thanks
Daniel
1 REPLY 1
Jonathan-Sherman
15 - Aurora
15 - Aurora

Not sure what you want to show for where neither of the two conditions are met, but you just need to add in another ELSEIF to test for where only condition 1 is met if condition 2 isn't:

 

IF [Sysref]=[Row+1:SysRef] AND [DateTime_Out2]=[Row+1:DateTime_Out2] THEN "Ok"
ELSEIF [Sysref]=[Row+1:SysRef] THEN "NotOk"
ELSE ""
endif
Labels