Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Transform and pivot

mbeck
5 - Atom

I would like to take the before spreadsheet and turn it into the after.   I am guessing Transform and Cross Tab will be used but i have been unsuccessful.  

I need to pivot off all the fields in rows 1, 2 and 3 except field XYZ_00.  

 

Before:

 

 

  

PQ_01

RS_07

XYZ_00

 
  

Budget

Budget

Budget

Budget

  

Mar

Jun

Sep

Dec

ABCD1234

GH123

                 149,745.75

 0

               167,132.70

 0

 

After

      

XYZ_00

Mar

Budget

RS_07

PQ_01

ABCD1234

GH123

149745.8

Jun

Budget

 RS_07

 PQ_01

 ABCD1234

 GH123

0

Sep

Budget

 RS_07

 PQ_01

 ABCD1234

 GH123

167132.7

Dec

Budget

 RS_07

 PQ_01

 ABCD1234

 GH123

0

 

 

Thanks for any help that can be provided.

5 REPLIES 5
patrick_digan
17 - Castor
17 - Castor

@mbeck You were right on track that you needed a transpose and then a crosstab. If you add a recordid, you could do a transpose and then a crosstab and get most of the way there. To get the rest of the way, I've done a lot of monkeying around before the crosstab. I've made a lot of assumptions that the size of your data won't change.

 

Hope that helps!

mbeck
5 - Atom

Thank you very much for putting in the time to solve this.   I will review and let you know if this works for all the scenerios i have.   unfortunately the number of rows can change but hopefully I can modify what you have done to make it work.

 

Thanks again!

 

mbeck
5 - Atom

sorry but i have tried to modify the logic without any luck.   I appologize as i should have given more data.   below is a more realistic sample with more data. 

 

Before

  PQ_01RS_07XYZ_00 
  BudgetBudgetBudgetBudget
  MarJunSepDec
ABCD1234GH12314974601671330
CDEEF5678GH12306838210276222274
ABCD1234IH45618900000
CDEEF5678IH45610575517547250

 

After

      XYZ_00
MarBudgetRS_07PQ_01ABCD1234GH123149746
MarBudgetRS_07PQ_01CDEEF5678GH1230
MarBudget RS_07  PQ_01  ABCD1234  IH456 18900
MarBudget RS_07  PQ_01  CDEEF5678  IH456 10575
JunBudget RS_07  PQ_01  ABCD1234  GH123 0
JunBudget RS_07  PQ_01  CDEEF5678  GH123 68382
JunBudget RS_07  PQ_01  ABCD1234  IH456 0
JunBudget RS_07  PQ_01  CDEEF5678  IH456 5175
SepBudget RS_07  PQ_01  ABCD1234  GH123 167133
SepBudget RS_07  PQ_01  CDEEF5678  GH123 102762
SepBudget RS_07  PQ_01  ABCD1234  IH456 0
SepBudget RS_07  PQ_01  CDEEF5678  IH456 4725
DecBudget RS_07  PQ_01  ABCD1234  GH123 0
DecBudget RS_07  PQ_01  CDEEF5678  GH123 22274
DecBudget RS_07  PQ_01  ABCD1234  IH456 0
DecBudget RS_07  PQ_01  CDEEF5678  IH456 0
patrick_digan
17 - Castor
17 - Castor

@mbeck I went back to the drawing board, and I'm much happier with the workflow now. It will allow you to have as many rows as you want. It's also much cleaner. 

 

Let me know if you have any questions!

mbeck
5 - Atom

Patrick_digan,

That is awesome.  Thank you very much!  

Labels