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

dynamically select data columns

tiverson
8 - Asteroid

I have a report that has multiple columns of data based on period.  How can I make this dynamic so that only the current and prior period is selected?

 

Column select.jpg

 

For this example, column V is the current period and column T is the prior period.  

How would I only display those columns (along with Columns A-G)

 

Thanks

5 REPLIES 5
cjaneczko
13 - Pulsar

Simple way to do this would be to use a Field Info tool and then filter that grabs the most recent two dates. You'll need to add a record ID field as well. Then Crosstab the Field Info based on Record ID for the header and Name as the data. Use a Dynamic Rename tool and make the Name as the new Header. Then Union back to your original Dataset and only union only on the fields from your Crosstabbed data set. 

binuacs
21 - Polaris

@tiverson you can use the dynamic select tool for this, the same logic you can see in your previous post

https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Calculate-Difference-between-v...

 

tiverson
8 - Asteroid

@binuacs , I tried the other workflow to my data and am not getting any of the "period" data.  The example used in my original question had the periods as data type "Double", where this example has V string for the Period values.  I want to try and change the data type to Double dynamically since the number of columns will change.  (I even tested by manually changing all of the "EAC" columns to double and still was unable to get any output)

 

I'm sure I have something wrong in my formula, but not sure what it is?

 

Data type

data type.jpg

Dynamic select formula

dynamic select formula.jpg

Output

dynamic select output.jpg

  

CoG
14 - Magnetar

It doesn't look like the Column Names have a space in them. Have you tried dropping the CharFromInt(10)?

binuacs
21 - Polaris

@tiverson I am able to run the workflow with your test file 

image.png

Labels