Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Unpivoting

SebastianRo
5 - Atom

Hi, I have a dataset in the following structure, reflecting IDs of Parent Legal entities in one column, with the IDs of their Subsidiary Legal entities in a second (Subs). Some Parents have zero Subs.

 

ParentSubs
654-
843186; 175; 325; 211
184-
746514; 851; 222
567117
962-

 

I want to convert that into a set where the first column indicates all the IDs )Parents + Subs) and then the second column what the parent entity is, or, if it is a parent entity itself "Parent". Like this:

 

IDParent ID
654Parent
843Parent
186843
175843
325843
211843
184Parent
746Parent
514746
851746
222746
567Parent
117567
962Parent

 

It requires splitting the Subs column by delimiter, then unpivot, but also adding a record for the Parent itself. I could not figure out the last step...anybody who can help?

8 REPLIES 8
binuacs
20 - Arcturus

@SebastianRo One way of doing this

 

binuacs_0-1659029414984.png

 

 

taylor_butler
Alteryx
Alteryx

Hi @SebastianRo

I made a slight modification, but similar approach to the others. I start by splitting to rows on the semicolon using Text to Columns, then replace the dashes with the Parent ID and union to ensure all IDs, including Parents with Subsidiaries are listed. Attached is a workflow for reference.

 

 

taylor_butler_0-1659023779583.png

 

 

OllieClarke
15 - Aurora
15 - Aurora

Hey @SebastianRo how's this:

OllieClarke_1-1659021928504.png

First you flag the IDs with no subs as Parent, then flip out all IDs, then you can join back on to get their parent ID and flag the fall out as Parents too.

 

Hope that helps,

 

Ollie

 

OllieClarke
15 - Aurora
15 - Aurora

Hey @binuacs I'm not sure that's right. The ID column (parent in yours) should be unique and show all 14 values, whereas your values are split over both columns

NataliaElias
7 - Meteor

Hi! I also gave it a try. It is probably not the most efficient way (it is my first time answering a question); but I think it works! Best, Natalia

SebastianRo
5 - Atom

Thanks for this. The step missing here is the additional record for "Parent" for Parent IDs that have Subs. The 843 for example:

 

843Parent
186843
175843
325843
211843
OllieClarke
15 - Aurora
15 - Aurora

@SebastianRo 

Think my solution does this:

OllieClarke_0-1659023343024.png

 

binuacs
20 - Arcturus

@SebastianRo updated workflow attached @OllieClarke thanks for pointing out the mistake 

 

binuacs_1-1659029465066.png

 

Labels