Alteryx Designer Desktop Discussions

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

Combining headers from 2 rows into 1

Paul_s_Moody
8 - Asteroid

Hi,

I'm using a workflow to try to read in a large *.csv file which is the ouput from an upstream process generating a set of simulated random numbers.

The difficulty is that the file has headers on the top 2 rows where the 1st row is the part of the organisation the data relates to (so not unique!) and the 2nd row is the investment type.

 

A (very) simplified example is:

 

 GroupGroupGroup  Company ACompany A  Company BCompany B
 Interest RatesCreditEquity  Interest RatesCredit  CreditEquity
Iteration3150.4557448470.9593744470.247120185 Iteration3890.3552180720.0665424 Iteration20.4879989980.775020332
Iteration710.6790928750.4092900410.319077558 Iteration9780.3991888550.325160899 Iteration79740.1885920530.562055868
Iteration41590.4458708140.674567650.764315277 Iteration50.3325508130.829799849 Iteration115780.0438750380.406174081

 

I'd like to read in the data and transform so that I have a single (and unique) set of headers: Company¦Investment, e.g:

 

 Group¦Interest RatesGroup¦CreditGroup¦Equity  Company A¦Interest RatesCompany A¦Credit  Company B¦CreditCompany B¦Equity
Iteration3150.4557448470.9593744470.247120185 Iteration3890.3552180720.0665424 Iteration20.4879989980.775020332
Iteration710.6790928750.4092900410.319077558 Iteration9780.3991888550.325160899 Iteration79740.1885920530.562055868
Iteration41590.4458708140.674567650.764315277 Iteration50.3325508130.829799849 Iteration115780.0438750380.406174081

 

This operation is trivial in Excel, but as the file of random numbers is ~0.5Gb I'd rather not have to generate a copy of the data!

 

Hopefully there is a simple solution in Alterxy too...

 

Once read in, I'd then need to split into each block of data (so in this case 3 seperate tables) as different operations will be carried out on the different parts of the company.

 

3 REPLIES 3
binuacs
20 - Arcturus

@Paul_s_Moody One way of doing this

image.png

Prometheus
12 - Quasar

@Paul_s_Moody Here's one way to do it. First, you can configure your Input Data tool so the field names are in your data by unchecking "First Row Contains Field Names." Then you can use the Sample tool to grab the first two records and concatenate the values. For some reason, the Summarize tool wouldn't let me use the pipe "|" as a delimiter, so I just used the Multi-Field Formula tool after Summarize to replace commas with pipes. Then I unioned the rest of the data (make sure the field names are the #1 connection. Then renamed the fields.

Combining Headers.PNG

Paul_s_Moody
8 - Asteroid

Thank you!

Labels