Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Transpose every n Rows

aysha6029
8 - Asteroid

Hello Friends,

 

I have a table as below. I need to transpose every 4 Columns into a table . Can you please help me to solve this probelm.

 

Query

NameHelen
AddressFirestone Avenue
CityCavespring
StateArkansas
NameCharles
AddressTurnbridge Drive
CityDallas
StateTexas

 

Required Result

NameAddressCityState
HelenFirestone AvenueCavespringArkansas
CharlesTurnbridge DriveDallasTexas
8 REPLIES 8
jdunkerley79
ACE Emeritus
ACE Emeritus

Use a record id to add a row number.

Then use a formula tool to adjust this to be blocks of 4:

Floor(RecordId/4)

Then use a cross tab to flip round.

 

aysha6029
8 - Asteroid

Hi,

 

Sometimes i have different row where i cannot apply the Floor command. In the below table, i have 4 rows belonging to one record and next three rows that belongs to different set of record. how to do a crosstab for this scenario

 

Query

NameHelen
AddressFirestone Avenue
CityCavespring
StateArkansas
NameCharles
AddressTurnbridge Drive
CityDallas
  

 

jdunkerley79
ACE Emeritus
ACE Emeritus

In this case I would use a multi-row formula to create a grouped record id rather than the RecordID tool. 

 

[Row-1:RecordID]+IIF([Field1]="Name",1,0)

Updated sample in 10.0 format attached.

aysha6029
8 - Asteroid

Hi,

 

Thank You for responding to my Query. Can you please explain the meaning of below expression.

 

[Row-1:RecordID]+IIF([Field1]="Name",1,0)

 

jdunkerley79
ACE Emeritus
ACE Emeritus

This is a multi-row formula creating a RecordID field eqial to the running count of times Field1 = Name.

 

[Row-1:ReordID] is the value of the RecordID on the row above. If the first row this will be 0.

IIF(...) is the inline IF function (I personally prefer over IF THEN ELSE ENDIF but no real difference).

The IIF function evaluates to a 1 if Field1 is equal to Name otherwise it is 0.

 

Hope that makes sense! 

aysha6029
8 - Asteroid

Thank You. It is working.. 

 

I ran into another issue. Request your help.

 

 

I ran the Workflow and generated grouping numbers to transpose the records in proper order. My requirement is to neglected all the Result with Error ( Grouping 2) and take only the Success Records ( Grouping no 1 and 3) and transpose them to a excel sheet. Please help me to solve this problem.

 

ResultSuccessGrouping
NameMike1
AddressGravette1
ResultError2
Error DetailError out2
ResultSuccess3
NameHarrison3
AddressJoplin3
jdunkerley79
ACE Emeritus
ACE Emeritus

I woudl say the easiest way is to transpose all the records so you have one row per grouping

 

Then use a filter tool to filter on the Result column. You can then just keep the rows where Result = success

aysha6029
8 - Asteroid

Thank You. Its is working

Labels