Free Trial

Alteryx Designer Desktop Discussions

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

Rows to Columns

dlesny
8 - Asteroid

Hi Sorry if this is already answered somwhere but I cannot find it. I need to split one row into columns:

 

RecordIDValue
225
23tests
280
29failures
340
35ignored
401.003s
41duration
50100%
51

successful

 

 into this:

 

testsfailuresignoreddurationsuccessful
5001.003s100%
8 REPLIES 8
mbarone
16 - Nebula
16 - Nebula

Since both your headers and values are in the same column, and can be a mix between numbers and text, I see no way of doing this UNLESS you have a hard and fast "rule" to determine which cells in that column are headers and which are the values that go under the headers.


Is there any such rule you?  In your example, it looks like the odd-numbered record IDs are the headers and the even-numbered record IDs are the values.  Is that always going to be the case?  It also appears that every other row is a header/value (i.e., they alternate)?  Is that always the case?  Will the VERY FIRST row ALWAYS be a value and then alternate from there on out as header/value, header/value?


If there is a rule, then it can be done.

 

Or are you doing the opposite?  I can't tell from the phrasing of the question versus the examples  you gave.

dlesny
8 - Asteroid

Hi, thank you for your help

 

yes that will always be the case for both, I am transforming HTML cucumber report, the id's are just leftovers from my previous transformations, can be removed or input again from one.

BenMoss
ACE Emeritus
ACE Emeritus

Here is a solution but of course I have made several assumptions.

 

My guess is there is likely multiple instances which perhaps have a seperate ID column to indicate which instance they belong. In my example I have created two examples. One purely with the data you have and one with how to deal with it if you have multiple instances.

 

Ben

mbarone
16 - Nebula
16 - Nebula

What will be the case for both?  That the first record will always be the value and then alternate between header and value?  So you want to transform the 2-column 10 record table INTO the 1 record 5 column table?

mbarone
16 - Nebula
16 - Nebula

Here's something based on the assumptions that (1) first record will always be the value, and each record there after will alternate between header and value, and (2) you want to go from 2 columns to however-many-header columns.

 

Step 1:  Your incoming records___01.jpg

 

 

Step 2:  Issue a record ID

___02.jpg

 

Step 3:  Make even records headers, and odd records values:

___03.jpg

 

Step 4:

Assign header-value pairs the SAME number. Doesn't matter what the numbers are, as long as the alternating headers/values have the same number:

___04.jpg

 

Step 5:  First of a double cross-tab.  Get the header/values lined up correctly:

___05.jpg

 

Step 6:  Second of the double cross tab:  Stretch out the data into one row:

___06.jpg

 

That should do it.

dlesny
8 - Asteroid

Great, thank you that works perfectly.

Anusha9
5 - Atom

Hi,

I have been working on the same example in the given workflow you have created with multiple instances in single column what if we have multiple columns like

Input Date:

Field 1Field 2Field 3
NameNameName
Mary GuidryHerman HesseTerrance Delpit
DepartmentDepartmentDepartment
TrainingCustomer SupportHR

 

And I need the output like:

 

NameDepartment
Mary GuidryTraining
Herman HesseCustomer Operations
Terrance DelpitHR

 

 

Thanks in advance

patel_bm
8 - Asteroid

@Anusha9, all you need is to move all the columns Field 1 ,2 and 3 into a single column before using the solutions already provided by @BenMoss and @mbarone .

 

Here's my solution workflow for you.

 

Hope this helps.

 

Labels
Top Solution Authors