Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Pivoting the data and lookup for desired column value

KamilaWaclawska
5 - Atom

Hi, I am trying to find a flow to  solve my problem which requires data pivoting & lookup per Theme items.

 

My starting point is an Input table where particular Theme has multiple Level Codes & their corresponding Names. Each Code has some number of characters but values can start from Level 1 or Level 2,3,4,5. Final one is 5. Then the following Level Code has +1 character length.

What I am trying to do is to extract only 2 characters length value per each Theme and then derive what is its corresponding Level (Number) Code and Level Code Name.

 

Having in mind that the most granular is Level 5 Code I can create new column which has 2 characters length value based on Level 5 Code filling. However my concern is how to lookup which column from Input has this value & then derive its corresponding Name.

 

Input

ThemeLevel 1 CodeLevel 1 Code NameLevel 2 CodeLevel 2 Code NameLevel 3 CodeLevel 3 Code NameLevel 4 CodeLevel 4 Code NameLevel 5 CodeLevel 5 Code Name
AppleAEuropeAHMiddle EuropeAHDPolandAHDGWarsawAHDGNOchota
BananaGAsiaGDEast AsiaGDTJapanGDTXTokioGDTXLGinza
Tomato(blank)(blank)BAfricaBFNorth AfricaBFTEgyptBFTOCairo
Pasta(blank)(blank)(blank)(blank)YNorth AmericaYKUSYKSCalifornia

 

Desired output (output might have all input data as well, my focus is on 3 columns after theme):

Theme2 characters CodeCorreponding LevelCorreponding Code Name
AppleAHLevel 2 CodeMiddle Europe
BananaGDLevel 2 CodeEast Asia
TomatoBFLevel 3 CodeNorth Africa
PastaYKLevel 4 CodeUS

 

Any ideas will be much appreciated.

1 REPLY 1
atcodedog05
22 - Nova
22 - Nova

Hi @KamilaWaclawska 

 

Here is how you can do it.

 

Workflow:

atcodedog05_1-1622110677732.png

 

1. Using transpose with theme as key tool convert columns to rows

2. Using formula tool find the corresponding level

3. Using filter find code with 2 character

4. Using another filter finding only names.

5. Using join tool joining them together to get all columns.

 

Hope this helps🙂

Labels