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

Isolate single column using If statement or filter?

BenJones13
7 - Meteor

Hey guys,

 

Is it possible to isolate a single column using an IF statement? I don't want to use the Select tool to deselect the columns I don't need as the column I need will be conditional based on another column.

 

For example, if [Period] = P11, then I would like to isolate the P11 column by itself. If Period = P12, then isolate P12. This would happen many times and it isn't feasible to manually deselect using the Select tool.

 

AccountAccount NumberP11P12Period
Sales10.10.3P11
6 REPLIES 6
binuacs
21 - Polaris

@BenJones13 One way of doing this by transposing the data and filter out the records which you want

 

binuacs_0-1680028792942.png

 

SPetrie
13 - Pulsar

When you say isolate, do you mean you want only the column specified in the Period column to be left for the next tool to act upon, or you just want to single out the column for use later in the flow?

In the example above, do you want a single column of P11 since that was was in Period, or do you need all columns to continue through the flow but we are just using P11 as the focus?

BenJones13
7 - Meteor

Hi @SPetrie,

 

Sorry for not clarifying! @binuacs Thanks for the speedy reply but as @SPetrie mentioned, I want the single column of P11 by itself.

 

It would go from this

AccountAccount NumberP11P12Period
Sales10.10.3P11

 

To this, based on the condition aforementioned:

P11
0.1
binuacs
21 - Polaris

@BenJones13 updated the workflow

 

binuacs_0-1680029512454.png

 

SPetrie
13 - Pulsar

Another method is to use a combo of dynamic rename and dynamic select.

I use a dynamic rename to update the description of the column named in the period column and then use a dynamic select to remove any column that doesnt have the "keep" description.

SPetrie_3-1680029937662.png

 

SPetrie_1-1680029874156.png

 

 

 

BenJones13
7 - Meteor

Thank you so much for the help! I think I'll go ahead with this one @binuacs, seems simple and replicable to my untrained eyes!

 

Thank you very much @SPetrie too. Really appreciate the speedy and helpful replies.

Labels