Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Data rearrangement based on specific structure

The1804
7 - Meteor

Hi,

 

I'm looking for a solution that would help me rearrange columns in a specific way.

 

Here is my input data:

Level1IDLevel1NameLevel2IDLevel2NameLevel3IDLevel3Name
MEMiddle EastAEEmiratesAE01Emirates 01
MEMiddle EastAEEmiratesAE02Emirates 02
MEMiddle EastAEEmiratesAE03Emirates 03
AMAmericasCACanadaCA01Canada 01
AMAmericasCACanadaCA02Canada 02
AMAmericasARArgentinaAR01Argentina 01
AMAmericasBRBrazilBR01Brazil 01
EUEuropeGBGreat BritainGB01Great Britain 01
EUEuropeGBGreat BritainGB02Great Britain 02
GBLGlobal  ES01Spain 01
GBLGlobal  CY02Cyprus 02

 

and required output:

 

LevelIDAboveBelowLevel
ME AELevel1ID
CAAMCA01, CA02Level2ID
AM CA, AR, BRLevel1ID
AE01AE Level3ID
AE02AE Level3ID
AE03AE Level3ID
EU GBLevel1ID
GBL ES01, CY02Level1ID
AEMEAE01, AE02, AE03Level2ID
ARAMAR01Level2ID
BRAMBR01Level2ID
GBEUGB01, GB02Level2ID
CA01CA Level3ID
CA02CA Level3ID
AR01AR Level3ID
BR01BR Level3ID
GB01GB Level3ID
GB02GB Level3ID
ES01GBL Level3ID
CY02GBL Level3ID

 

All level values are presented in 1st column (4th column specifies source column from input).

Column "above" shows 1st level to the left from specific value that is not empty (case of ES01 and CY02).

Column "below" groups together all values to the right from specific value (doesn't go all the way down. Only 1 level below)

 

Some assumptions that might simplify the solution:

  • Each level can only cascade up to 1 level but can have multiple levels below.
  • There can't be duplicates on any level
  • There can be more than 3 levels (up to 10)

Let me know if I can provide any more info.

2 REPLIES 2
atcodedog05
22 - Nova
22 - Nova

Hi @The1804 

 

This weekly challenge might be helpful for your scenario of creating hireacrhy  https://community.alteryx.com/t5/Weekly-Challenge/Challenge-12-Creating-an-HR-Hierarchy/td-p/36740

 

Hope this helps 🙂

The1804
7 - Meteor

Hi @atcodedog05,

 

Thanks for the suggestion! I went through some of the provided solutions and it looks like I would have to reverse the challenge to some degree. Unfortunately that is a bit above my capabilities 🙂 Still learning...

 

I almost managed to get the expected result but I still have trouble figuring out how to skip a level both above and below. Also my solution cannot go further than 3 levels which isn't a big deal - I can manually add more blocks if needed.

 

If someone could help out with skipping empty levels (having GBL as above in CY02,ES01 and vice versa) I would really appreciate it.

 

My hacky solution in attachment.

Labels
Top Solution Authors