Alteryx Designer Desktop Discussions

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

Grouping columns by date

Felipe_Amancio
7 - Meteor

Hi masters,

 

I came across the situation below where I have a table that have 3 columns for every month of the year 

 

   TCCOFEPMTCCOFEPMTCCOFEPM
AccountTypeProductJan-23Jan-23Jan-23Feb-23Feb-23Feb-23Mar-23Mar-23Mar-23
0001RevenueAAA              50              20              15              45              35              20              25              35              45
0002RevenueAAA               -                30                8              38              28              13              18               -                20
0003ExpenseBBB              15              23                8              38              28              13              18               -   
0004RevenueDDD              35              20              20              35              45              50              20              15              45
0005RevenueAAA              20               -                 -                15              38                8              38               -                 -  
0006RevenueCCC              50              20              15              45              35              20              25              35              45
0007ExpenseBBB              43              13                8              38              43              13                8              38              28
0008ExpenseBBB              45              50              20              15              45               -                15              45              35

 

I would like to group the columns with the same month, having only the total per month (see below). Is there an easy or right way to do it (like a dynamic columns grouping) considering that the original table has thousands of rows and 36 columns of month (3 x 12 months).

 

AccountTypeProductJan-23Feb-23Mar-23
0001RevenueAAA              85           100           105
0002RevenueAAA              38              79              38
0003ExpenseBBB              46              79              18
0004RevenueDDD              75           130              80
0005RevenueAAA              20              61              38
0006RevenueCCC              85           100           105
0007ExpenseBBB              64              94              74
0008ExpenseBBB           115              60              95

 

Thanks

 

Felipe Oliveira

2 REPLIES 2
StevenP
8 - Asteroid

Hi @Felipe_Amancio,

 

Utilizing Transpose and Cross Tab tools will enable you to group these headers in a dynamic and easy way.

 

First remove the top first header either in the input tool configuration or through a dynamic rename tool. From there Transpose the data by grouping the main key columns (Account, Type, Product) and setting the dates as the data columns along with Dynamic or Unknown Columns then remove the trailing numbers generated from the duplicate header warnings. After that's done you can just simply Cross Tab the data back into the format you are looking for. Adding in some extra steps in between can ensure the columns are sorted in the right way.

 

See attached for a completed workflow example.

Felipe_Amancio
7 - Meteor

Thanks StevenP! it worked great!

Labels