Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Cross-tab or Transpose of blocks of columns (load data into excel)

timewaste
8 - Asteroid

Hi Peers,

 

I am trying to transpose the data into 3 sets to write back in to excel. Please see below for my source data:

 

VEDDFSFSPHTH
RBGNCTePHM14.4
RBGNCTePHA1.6
RBGNCTePHV0
RBANCBuPHM16
RBANCBuPHA0
RBANCBuPHV0
RBANCZiPHM0
RBANCZiPHA0
RBANCZiPHV0

 

and my output must look like:

 

 VRRRRRRRRR
 EDBBBBBBBBB
 DGGGAAAAAA
 FNCNCNCNCNCNCNCNCNC
 SFTeTeTeBuBuBuZiZiZi
 TMAVMAVMAV
SPHPH14.41.601600000

 

How can I achieve this? Please advise.

 

TIA!

13 REPLIES 13
danilang
19 - Altair
19 - Altair

Thanks for the update.  I'm looking at it in my spare time.  There's a key manipulation step that I'm missing, but i'll keep thinking about it.

 

Dan

timewaste
8 - Asteroid

Sure @danilang looking forward to it!

danilang
19 - Altair
19 - Altair

Here you go.

 

It took a while to get the data columns lined up with the header ones while at the same time keeping the data values in separate rows when required 

 

Results.pngSolution2.png

 

It was a tough one!  You should submit it as a weekly challenge!

 

 

Dan

timewaste
8 - Asteroid

@danilang Thanks a ton! Sure, I must submit it as a weekly challenge.

But, there is one minor glitch here. You see row numbers 8 and 10 in the output. They have the same SPH value as PH. So, they must be combined into 1 single row. In the output, it must be like this in row number 8:

SPH   PH   14.4   1.6   0   2.5   6   0   0   0   0

and row number 10 must be avoided... similarly in all cases whenever SPH row value repeats. I think the change needs to happen in Building Group stage. Here the group number is calculated based on SF values of each row. But, if you could mention where exactly I need to change in order to accommodate that, it would be great!

if isnull([Row-1:GroupNumber]) then
1
elseif [Row-1:SF] != [SF] then
[Row-1:GroupNumber]+1
else
[Row-1:GroupNumber]
endif

But, nevertheless, you have been an immense help! Appreciate your support throughout.

Labels