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.

Convert values in a column to rows and show the data in Amt as values

srk0609
8 - Asteroid

I have a column period which has values JAN-24 to DEC-24. I want to have a column for each value in period column. There is a measure column Amt(highlighted in sheet 1) the values in this column needs to be populated in new columns formed from values present in period column. I'm attaching below a excel file. Sheet 1 represents current state of data and Sheet 2 is how I would like the data to be. Can anyone please suggest a solution? Thank you.

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

@srk0609 
We can do the CrossTab to bring the vertical to horizontal but with some small tricks since we want to keep the order of month.

0918-srk0609.png

srk0609
8 - Asteroid

what should I do get DEC-24 column first and JAN-24 in the last? Opposite of what it is currently in the Workflow that you provided? could you please let me know? Thank you

CoG
14 - Magnetar

You would just need a way to reindex the NewPeriod field so that when sorted in increasing order the list ends up being reversed. There are smart ways to do this and then there's the simplest way for me share.

 

If you update @Qiu 's Formula Tool with the following: 

ToString(999999-ToNumber(DateTimeFormat([DateTime_Out],"%Y%m")))+"_"+[period]

then you should achieve the desired result, which will work for the next several thousand years.

 

Happy solving!

Qiu
21 - Polaris
21 - Polaris

@CoG 
Very smart one!

@srk0609 
It did appear to me that in your desired output of the Excel file the months are in accending order.
0918-srk0609-r1-C.png
but anyway, following suggestion from @CoG 
This is how it looks like.

0918-srk0609-r1-A.png0918-srk0609-r1-B.png

Labels