Alteryx Designer Desktop Discussions

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

How do I pivot with repeating columns

David_Mosk
6 - Meteoroid

Below is what my data looks like. Attached is the full data set.

 

There are 3 possible job families - FIN, HR, IT

There are 2 possible Actions - TER, HIR

Then there is a KPI_Calc_Sum score.  Not all possible combinations exist for each Company.

 

I would like to pivot the data so each row is a unique company name with the fields being broken out as below where each field is a possible Job Family / Action combination which is 6 in total.

 

This is the original data format

EntityJob FamilyActionKPI_Calc_Sum
Company_1FINTER0
Company_1HRTER0
Company_2HRHIR3
Company_2HRTER2
Company_3FINTER2
Company_3HRHIR0
Company_3ITHIR0
Company_3ITTER2
Company_4HRHIR0
Company_5HRTER2
Company_5ITHIR0
Company_5ITTER0

 

This is what I would like to do

EntityFIN HIRHR HIRIT HIRFIN TERHR TERIT TER
Company_1   00 
Company_2 3  2 
Company_3 002 2
Company_4 0    
Company_5  0 20

 

Thanks!

2 REPLIES 2
AbhilashR
15 - Aurora
15 - Aurora

Hi @David_Mosk, the Cross Tab tool helps you pivot the data and the config of the tool will look something like:

AbhilashR_0-1606361649545.png

Given your pivoted column header was across multiple columns in your source file, as a first step we concatenate them using a Formula tool (Combined in my example), and then pivot it using a Cross Tab tool. I have attached a working example of my approach here.

 

Hope this helps and let us know if you need would like an additional explanation around the approach.

 

David_Mosk
6 - Meteoroid

@AbhilashR Thanks! That's great!

 

I think there is one last step missing. I added a Summarize node as the last step grouping by Entity and then Summing the remaining fields. This makes each row represent a single Entity.  Attached is the tweaked workflow.

 

Labels