We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Find a particular column and select all columns before it

Mtvbqb
7 - Meteor

Hello,

 

I have a data set where the number of columns will shift. I know that I want to keep column "GROSS" and all of the columns before it.

 

I'm looking into the Dynamic Select tool, and have been able to select the "GROSS" column.

 

FINDSTRING([Name], "GROSS")>-1

 

I'm at a loss on how to select the columns before it as well. Could I somehow determine the FieldNumber of the "GROSS" column and then do a select FieldNumber

10 REPLIES 10
goatley1
8 - Asteroid

I'm assuming you won't have to clean up the data as much as I did so the first filter will have to be customized. Essentially you need to ensure that Set B is the first record. Sample the first record. Then we transpose the fields and test for the Set B in the value field.  Use a multi row formula to find Set B and flag every record from set B while the field name is <= F33 using if then (I use 1 and 0).  Drop all the records that don't pass the multi-row formula with a 1.  Cross tab your field names back to columns.  Then drop all records with the sampling tool.  Union with the original filtered data set and keep only common fields.  This should work for your situations.  

 

Now I followed your instructions to a T this will always return the first field Fn (where n = any number form 1-33) through F33.  If you meant to grab the next n fields, the you will have to tweak the multi-row formula to accumulate instead of flag.  Subsequently filter for binary_test <= n.  Hope this Helps

Labels
Top Solution Authors