community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Community v19.6

Looks aren't everything... But the latest Community refresh looks darn good!

Learn More
SOLVED

Rows to Columns

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%
Pulsar
Pulsar

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.

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.

Alteryx Certified Partner
Alteryx Certified Partner

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

Pulsar
Pulsar

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?

Pulsar
Pulsar

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.

Asteroid

Great, thank you that works perfectly.

Labels