Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Un-concatenating row data into column headers with boolean true false

SideOfRanch
8 - Asteroid

I found some threads doing similar stuff but everything I can find doesn't seem to work for me.

 

I have a dataset similar to this:

IDMARKETOther data
1GA123123
2TN41642
3TN;GAu76575
4AL;TN;NC;ND;TX3454

 

Trying to convert to

IDMarketALGANCNDTNTX
1GA010000
2TN000010
3TN;GA010010
4AL;TN;NC;ND;TX111111
        

 

I think it's some combination of creating a lookup table by converting the market's to rows and then doing a crosstab to create columns and generate result, but cannot figure it out.

2 REPLIES 2
Maskell_Rascal
13 - Pulsar

Hi @SideOfRanch 

 

Here is how you can do it. 

Maskell_Rascal_0-1628286603013.png

 

I'm Parsing your Market field down to get a list of headers to use. Then Crosstab back with some Formula tools in there to get the desired values. Finally, I just Join it back to the original data to get the output. 

 

Let me know if this works for you. 

 

Cheers!

Phil

 

atcodedog05
22 - Nova
22 - Nova

Hi @SideOfRanch 

 

@Maskell_Rascal's has already nailed it with his approach. It should work for your scenario 🙂

 

Here is my take on it. Core logic is almost similar.

 

Workflow:

atcodedog05_1-1628334381879.png

 

1. Using text to column to split market codes to rows

2. Using formula tool to add column count and set value as 1.

3. Using crosstab tool with key ID and Other data and market as name and count as value. You can pass all the main data columns as key and they will remain intact.

4. Using data cleanse tool to fill with 0 for null.

 

Hope this helps : )

Labels