Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Cross Tab to convert column to rows

alexis_d
7 - Meteor

My sample data looks like the following:

 

DateF1F2F3F4Amount1Amount2
1-1-2018tuaq5060
1-1-2018yibw-10-60
1-2-2018cpce-10709
1-2-2018bodr50020

 

The actual data is really huge and contains about 1 lakh records. I want to transform my data to get the below result:

 

f1f2f3f41-1-2018_Amount11-1-2018_amount22-1-2018_amount12-1-2018_amount2
        
        
        

 

Right now, I am using two cross tabs in parallel where in Cross tab 1 - I take New Colum headers as Date and value as sum of amount1 and I add another cross tab 2 - I take column headers as Date and value as sum of amount2. But, it's getting very difficult to align them and name them

What's the most efficient way of doing it?

 

Thanks in advance

5 REPLIES 5
SamDesk
11 - Bolide

Hello @alexis_d,

 

To aid in your custom renaming of cross-tab headers, you can make use of the Dynamic Rename tool.

Capture.PNG

Here we split your data stream into X streams, where X is the different number of Amount fields you have. In the example you provided, that's just Amount1 and Amount2 so we have split into 2 streams.

 

After performing the cross-tab for each individual Amount field we then use the Dynamic Rename tool to add in the delimiter "_AmountY", where Y is the current Amount field number. For the top stream, and Amount1, the formula looks like this:

[_CurrentField_]+"_Amount1"

The tool is configured like the following. I have left Dynamic or Unknown Fields checked so when you add in your dataset with the full list of dates, these will automatically be included in the rename process.

 

Capture.PNG

 

Hope this helps!

 

Sam :)

alexis_d
7 - Meteor

Hey,

 

Thanks for the solution. Also, is this the most efficient way of doing the cross tab? or is there any way I can do this data transformation?

SamDesk
11 - Bolide

Hey @alexis_d,

 

You could make it more efficient if you first transpose the amount fields. You could then create a concanated Header field that brings together Date and the transposed amount field name.

Capture.PNG

Sam :)

alexis_d
7 - Meteor

Sam - Thanks a lot. Saved a lot of trouble .

SamDesk
11 - Bolide

No problem at all @alexis_d, happy to have helped!

 

Sam :)

Labels