Alteryx Designer Desktop Discussions

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

Pulling rows above and below a certain column value

JWO221
5 - Atom

Hi 

 

In my dataset I am trying to create a list of rows adjacent (both above and below) the row where a columns cells has a specific value i.e.

 

C1    C2     C3     C4

13     10     -4       12 

12     14     -3       15

14     34      0        18

15     12      1        12 

12      13      5       21

 

From this dataset I would want to get the row with 0 in column C3, and then the two adjacent rows (the row before and after)

 

So it should look like:

 

C1    C2     C3     C4

12     14     -3       15

14     34      0        18

15     12      1        12 

 

I need to do this for anytime I have a 0 in column C3, any ideas?

5 REPLIES 5
patrick_digan
17 - Castor
17 - Castor

@JWO221 I would use a multi-row formula tool to flag the fields you want, and then filter them. 

 

patrick_digan_0-1623259202502.png

 

JWO221
5 - Atom

Yes, worked perfectly! Thank you!

GIS_User01
7 - Meteor

Hi!  I have a very similar situation.  Only difference is that I am looking for a value above 15 (instead of 0) and I am wanting to flag 20 rows prior to the occurrence and 20 rows after the occurrence (instead of 1 row prior and 1 row after).  How would I change my syntax to achieve this?

Christina_H
14 - Magnetar

@GIS_User01 It's possible to use the same method for your situation, but you would need to check 41 rows every time rather than 3.  Here's what I would do instead:

Christina_Hurrell_0-1631779545071.png

If you want to flag the rows rather than filter you just need to change the last few tools, formula and summarize rather than filter and unique would do it.

jourdan_17
5 - Atom

If I'm looking for a row containing a string what would the formula look like?

Labels