Alteryx Designer Desktop Discussions

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

How to cross tab vertical columns to horrizontal rows

Saravanan13
8 - Asteroid

Hello All,

 

I am looking to convert the below vertical columns to horizontal data as shown in output. Currently the output has two rows of data but might increase based on the input.

 

Can anyone assist.

 

Input -

 

Record noFieldValue
47149220value.0present
47149220idsignature
47149221value.0Application form
47149221idForm
47149222value.0October 2021
47149222idRevision
47149223value.0SINGAPORE
47149223idcountryCitizenship
47149224value.01/1/1900
47149224iddateOfBirth
47149225value.0John sena
47149225idfullName
47149226value.0NOT_SELECTED
47149226id6b
47149227value.0111111111H
47149227idID
47149228value.0SINGAPORE 11111
47149228idCity or town, state or province. Include postal code where appropriate.
47149229value.0SINGAPORE
47149229idcountryOfResidence
471492210value.0 
471492210idmailingAddress
471492211value.0John sena
471492211idPrint name
471492212value.0 
471492212idcountryOfResidence
471492213value.0 
47994170value.0present
47994170idsignature
47994171value.0Application form
47994171idForm
47994172value.0October 2021
47994172idRevision
47994173value.0JAPAN
47994173idcountryCitizenship
47994174value.01/1/1901
47994174iddateOfBirth
47994175value.0Richard Miller
47994175idfullName
47994176value.0NOT_SELECTED
47994176id6b
47994177value.02222222H
47994177idID
47994178value.0JAPAN 11111
47994178idCity or town, state or province. Include postal code where appropriate.
47994179value.0JAPAN
47994179idcountryOfResidence
479941710value.0 
479941710idmailingAddress
479941711value.0Richard Miller
479941711idPrint name
479941712value.0 
479941712idcountryOfResidence
479941713value.0 

 

 

Output -

 

signatureFormRevisioncountryCitizenshipdateOfBirthfullName6bIDCity or town, state or province. Include postal code where appropriate.countryOfResidencemailingAddressPrint namecountryOfResidence
presentApplication formOctober 2021SINGAPORE1/1/1900John senaNOT_SELECTED111111111HSINGAPORE 11111SINGAPORE John sena 
presentApplication formOctober 2021JAPAN1/1/1901Richard MillerNOT_SELECTED2222222HJAPAN 11111JAPAN Richard Miller 
9 REPLIES 9
DanielG
12 - Quasar

@Saravanan13  - there is a cross tab tool in Alteryx for this purpose.  Its in the Transform Ribbon.

Saravanan13
8 - Asteroid

Hello, I tried using but not able get in this format, Can you help with the workflow.

jNunez
8 - Asteroid

Is this the incoming data? You're not giving us nearly enough to work with.There's probably a better point earlier on in the workflow to help.

If this is the structure of the whole dataset then you can use a record id tool, start it at 0. Add a formula tool with one field containing Mod("# New Record ID Field", 24). This field will show which record in the horizontal table each row will belong to. You're dividing by 24 because there's 12 columns and each column has a field name and value cell. 

Then you'll filter the data stream by field = 'id', then join the true output to the false output anchor with join keys  = ('Record No.", and Field you created in formula Tool).

Saravanan13
8 - Asteroid

Hello, Yes this is a incoming data. So 24 columns is not a fixed number. It might change depending on the input.

binuacs
21 - Polaris

@Saravanan13 One way of doing this

image.png

Saravanan13
8 - Asteroid

Thank you so much. I have one problem. the order in my original dataset is not uniform. For example rows in value column will not be in same order. It will differ for each record ID. What should be workaround for this.

binuacs
21 - Polaris

@Saravanan13 Can you provide a sample file with different order of values, without seeing the input file it is difficult to come to a solution

OllieClarke
15 - Aurora
15 - Aurora

Hi @Saravanan13 in this instance one approach is to use a batch macro:

image.png

You can then deal with each row of data independently.

I calculate this row by taking the first 7 digits and splitting them out:
image.png

I group by this in the summarise tool to create the batches, and then use the row field to group by the batch macro too.
image.png

The batch macro itself just performs the cross-tab and rename, but in the interface designer properties, you can set to auto-configure by name, so this will align all headers after the macro has run.

Hope that helps,

Ollie
image.png

Saravanan13
8 - Asteroid

Thank you so much.. it worked.

Labels
Top Solution Authors