Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

How to get X amount of rows after a specific value

overhead_press
8 - Asteroid

Hi everyone, lets say I have a huge dataset (>100,000 rows, 9 columns), and every time when I find the value "ABC" in Column A, how do I go about extracting the 50 rows below it including all the columns? Thanks in advance! 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @overhead_press 

 

Can you provide some sample input and expected output it will help us get a better understanding of the usecase.

AngelosPachis
16 - Nebula

Hi @overhead_press ,

 

Assuming that your table looks like the one below and you need to keep 2 rows after the row that contains ABC in column A

 

AngelosPachis_0-1635355557619.png

 

You can assign a record ID to your table and then use a filter tool to extract the rows that have the value "ABC" in column A.

 

Then with a generate rows tool, you can create a new columns of all the ID you want to keep past the row that contains the ABC value. In my example, if row 1 contains ABC and I want to keep to more rows past that (in your case that should be changed to 50), the new record ID column will extend from 1-3

 

Finally, with a join tool you can bring back the records you need to keep from your main table, by joining the field you created in the generate rows tool, to the record ID field

 

AngelosPachis_0-1635355463463.png

Hope that helps,

Angelos

AngelosPachis
16 - Nebula

Any update on this @overhead_press ?

atcodedog05
22 - Nova
22 - Nova

Hi @overhead_press 

 

Here is my take on it. Since i was not clear I didn't attempt it. You can use multi-row formula to start row count from ABC and later use filter tool to filter n rows like below.

 

Workflow:

atcodedog05_0-1635515849049.png

 

Hope this helps : )

 

Labels