Alteryx Designer Desktop Discussions

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

Use value of one column to determine which column to pull another value

stvnhdmpa
8 - Asteroid

Hello all,

 

I'm trying to figure out a way to pull the value from a column based on the value in another column.  Below is a dummy sample of data.  I have a "Months" column that represents the column number that I need the value from.  The New Value column is what I need in the end.  The real data set has 200 columns and over 2 million records.  I think I could transpose the number columns and do a simple if then, but this takes so long to calculate because it creates about half a billion records in the transpose.  

 

 

Months12345678910New Value
10.0011.0012.0013.0014.0015.0016.0017.0018.0019.0010.001
20.0022.0024.0026.0028.00210.00212.00214.00216.00218.0022.002
30.0044.0048.00412.00416.00420.00424.00428.00432.00436.0048.004
30.0088.00816.00824.00832.00840.00848.00856.00864.00872.00816.008
40.01616.01632.01648.01664.01680.01696.016112.016128.016144.01648.016

 

Any thoughts?  Thanks in advance.

6 REPLIES 6
Qiu
20 - Arcturus
20 - Arcturus

@stvnhdmpa 

What is the logic for deciding your new values?

echuong1
Alteryx Alumni (Retired)

You can pivot your data, so you get month-value pairs in a vertical list. From there, you can find the rows that have the month = name. I wrapped the values in tostring() just in case one of them were to be picked up as a string/number.

 

From there, it was simply a join on the record ID to bring back the original full dataset.

 

echuong1_0-1613525921319.png

 

Qiu
20 - Arcturus
20 - Arcturus

@stvnhdmpa 

Sorry I think I just asked a stupid question.

Anyway, given the magnitude of your data set, it might be better to use a batch macro to level the computing load.

0217-stvnhdmpa.PNG

stvnhdmpa
8 - Asteroid

@echuong1, After spending way too much time on this and finally posting this and stepping away, I figured out how I could get to the answer by changing the upstream process.  The main lookup table is 200x200 records, the source data is 2.2M where I was trying to join and then transpose, which ended with about half a billion records.  What I ended up doing is transposing the lookup table and joining on the month and "name" column.  It was taking over 5 minutes to process before and now it is taking 10-15 seconds to process.  Thanks!

stvnhdmpa
8 - Asteroid

@Qiu  Interesting thought.  The package didn't seem to have the macro in the package.  Could you repackage with the macro?  I think I have the solution, but doesn't hurt to see the alternatives.

 

Thanks!

Qiu
20 - Arcturus
20 - Arcturus

@stvnhdmpa 
It is there named Month.

Qiu_0-1613599708926.png

 

Labels