Alteryx Designer Desktop Discussions

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

Dynamically Create Columns in an Analytic App

rnewby
7 - Meteor

I've been working for a few months on this problem, so hopefully, someone can help now...

 

I have a decent-sized dataset (~200 columns, ~250k rows), and inside there are a handful of columns with company names. I need to search through those columns and create a new binary column based on whether a certain company is there or not. The challenge is that this is part of an app, and the companies should be chosen based on the user. So UserA wants to see Company1, 4, and 6, while UserB wants to see Compant 2, 5, and 6. I won't know the companies in advance, nor how many companies will be chosen, so I can't create the columns in advance. 

 

I can't share the data, but I made this small dataset as an example:

 

Animal1Animal2Animal3Animal4Animal5Zoo

Budget(k)

Director

TigerMonkeyLionOstrichPenguinWashington8000

Mr. Brown

MonkeyZebraGiraffeLionGorillaPittsburgh3500Ms. White
TigerLionLlamaPenguinGiraffeOakland10000Ms. Green
CheetahMonkeyGorillaSnakeEagleCincinnati1500Mr. Black
LionGorillaGiraffeAntelopeBearKansas City4200Mr. Orange
EagleLlamaTigerBearSnakePhoenix5300Ms. Red
LlamaOstrichWarthogPenguinCheetahLos Angeles8500Mr. Blue
WarthogPenguinTigerGiraffeLionNew York9700Ms. Pink
GorillaTigerAntelopeCheetahWarthogBoston8800Mr. Yellow
CheetahElephantLlamaPenguinTigerMiami2500Mr. Gray
PenguinLionBearEagleGorillaLas Vegas2100Ms. Peach
GiraffeElephantWarthogAntelopeBearSeattle4600Ms. Purple
LionPenguinGorillaLlamaEagleDetroit1900Ms. Silver
TigerLlamaWarthogBearCheetahAtlanta7000Mr. Gold
Snake Lion Llama Giraffe Zebra Nashville2000Mr. Maroon

 

 

In this scenario, I have a list box that populates all the animals available:

 

Antelope
Bear
Cheetah
Eagle
Elephant
Giraffe
Gorilla
Lion
Llama
Monkey
Ostrich
Penguin
Snake
Tiger
Warthog
Zebra

The User of the app would choose whichever animals are desired. For example: Giraffe, Warthog, Bear

New columns would be generated, like:

 

HasGiraffeHasWarthogHasBearAnimal1Animal2Animal3Animal4Animal5Zoo

Budget(k)

Director

000TigerMonkeyLionOstrichPenguinWashington8000

Mr. Brown

100MonkeyZebraGiraffeLionGorillaPittsburgh3500Ms. White
100TigerLionLlamaPenguinGiraffeOakland10000Ms. Green
000CheetahMonkeyGorillaSnakeEagleCincinnati1500Mr. Black
101LionGorillaGiraffeAntelopeBearKansas City4200Mr. Orange
001EagleLlamaTigerBearSnakePhoenix5300Ms. Red
010LlamaOstrichWarthogPenguinCheetahLos Angeles8500Mr. Blue
110WarthogPenguinTigerGiraffeLionNew York9700Ms. Pink
010GorillaTigerAntelopeCheetahWarthogBoston8800Mr. Yellow
000CheetahElephantLlamaPenguinTigerMiami2500Mr. Gray
001PenguinLionBearEagleGorillaLas Vegas2100Ms. Peach
111GiraffeElephantWarthogAntelopeBearSeattle4600Ms. Purple
000LionPenguinGorillaLlamaEagleDetroit1900Ms. Silver
011TigerLlamaWarthogBearCheetahAtlanta7000Mr. Gold
100Snake Lion Llama Giraffe Zebra Nashville2000Mr. Maroon

 

Is there any way to do this dynamically in Alteryx?

 

Thanks!

 

2 REPLIES 2
CharlieS
17 - Castor
17 - Castor

Thanks for the example data to work with. I've attached an example solution. Check it out and let me know if this works for you. 

 

The key to achieve the desired output here is to Transpose the data so the fields used to perform the matching are standardized. After that, it's just a matter of transforming the data back using a Cross Tab tool and joining it back to the original data stream using RecordIDs.

rnewby
7 - Meteor

Yes! That worked wonderfully. Thank you so much. 

It took a little finessing to fit into my existing app, but once there it worked perfectly!

Labels