Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Multirow Formula Excluding Values not in the criteria

mstrolle
5 - Atom

Hello all, I am trying to create a new variable using the multi row formula tool using:

 

IF [Row-3:variable] != [Row-2:variable] AND

[Row-2:variable] != [Row-1:variable] AND

[Row-1:variable] != [variable] AND

[Row+1:variable] != [variable] AND

[Row+1:variable] != [Row+2:variable] AND

[Row+2:variable] != [Row+3:variable]  THEN

[Variable] else Null() endif

 

I am doing this for -30 rows, and +30 rows, so this is not all of the code. I want to exclude duplicate values only in the range(-30 to +30) The only difference is there are many more [Row-x:variable] != [Row-x:variable], but everything else is the same. It is working as intended, but for one thing. If there is a duplicate value in the column in the data input file, regardless if there are any other duplicate values within the -30 to +30 range, this code will null out the rows. I only want the rows in the range(-30 to +30) rows compared. Can anyone give me a hand with this? can provide more information if needed. Thanks!

 

1 REPLY 1
amanda_payne
8 - Asteroid

Have you considered adding a recordID to identify when you want the multi-row tool to start working?  Example below:

 

IF [RecordID] < 4 THEN [Variable]

ELSE IF [Row-3:variable] != [Row-2:variable] AND

[Row-2:variable] != [Row-1:variable] AND

[Row-1:variable] != [variable] AND

[Row+1:variable] != [variable] AND

[Row+1:variable] != [Row+2:variable] AND

[Row+2:variable] != [Row+3:variable] THEN

[Variable] else Null()
ENDIF

 

 

amanda_payne_0-1682518972747.png

 

Labels
Top Solution Authors