Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!
Free Trial

Alteryx Designer Desktop Discussions

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

Transform / pivot / group data question

Nicholas_White
8 - Asteroid

Hi everyone,

 

I've tried both the Cross Tab and Transpose tools in ways which I normally use them, and haven't had any luck.

 

Referring to the graphic below:

 

I get SOURCE_DATA from the reporting team. In this simplified example, you can see that there two CLASSES: FRUIT and VEGETABLE.

 

Within each CLASS, there are multiple ITEMS: APPLE and ORANGE; and CARROT, CAULIFLOWER, and LETTUCE

 

vitaminman12_0-1673984870552.png

 

My goal (and this is where I'm looking for guidance) is to transform the SOURCE_DATA into the TRANSFOMED data: each ITEM from each CLASS gets paired with each other ITEM from each other CLASS.

 

Is this a one-tool job? Something which requires Alteryx gymnastics?

 

Thanks,

 

Nick

 

5 REPLIES 5
Luke_C
17 - Castor
17 - Castor

Hi @Nicholas_White 

 

Try something like this. You can achieve the 'transformed' view with an append fields tool, then use formulas to create you're final tool.

Luke_C_0-1673991484998.png

 

 

 

apathetichell
19 - Altair

One quick addendum @Luke_C has assumed you have no duplicates in your data. If you have (potential) duplicates you'd want to hook up summarize tools in group-by mode for your fruit/vegetable fields before each anchor of your append data tool.

Nicholas_White
8 - Asteroid

@Luke_C ,

 

Thank you very much for your reply.

I had come up with a solution using the Append Tool like your example, but that solution is fixed by however many append tools I insert into the workflow.

 

In hindsight, I should definitely have mentioned in my original post that the SOURCE_DATA could contain potentially dozens of CLASSES, and hundreds of ITEMS

 

As an example, I added two more CLASSES (BAKERY and MEAT), with several more ITEMS inside them. The real SOURCE_DATA file would contain lots more information in it. 

 

vitaminman12_0-1673993857520.png

 

I think what I'm after is a way to dynamically break apart the SOURCE_DATA by CLASS, then do a Cartesian Join with all the ITEMS. 

 

Thanks,

 

Nick

Nicholas_White
8 - Asteroid

Hi everyone,

 

Ok, so one of the reasons I love this forum so much is because by communicating with others, you can sometimes answer your own questions by people presenting the same information you already had in a different manner.

 

When staring at @Luke_C 's proposed solution, it hit me that I needed to do a better search in the Community to see if my question had been answered already.

 

Fortunately, it had!

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Dynamic-Append-based-on-Column/td-p/66...

 

@PhilipMannering  proposed a Python solution which uses the PRODUCT() function from the ITERTOOLS library. I'll need to dig into it to fully understand how it works, but the outcome is exactly what I was looking for.

 

vitaminman12_2-1673996573020.png

 

 

This:

vitaminman12_0-1673996344824.png

 

Becomes this:

vitaminman12_1-1673996380232.png

 

Thank you,

 

Nick

 

Luke_C
17 - Castor
17 - Castor

@Nicholas_White Love it!

Labels
Top Solution Authors