Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My data structure is like so:
Fruit_Basket_Column
Apple, Orange, Banana
Kiwi
Orange, Apple
Banana, Kiwi
Apple
Now, I would like to create a new table that, given the Fruit_Basket_Column as an input, only displays unique strings (fruit, separated by commas above, though some baskets contain multiple fruit). My desired output is like so:
Desired_Table
Apple
Orange
Banana
Kiwi
With this table created, the app user could select one or multiple of these fruits, and the resulting plots, etc. would build by only retaining observations which contain at least one of the selected fruit/s in the Fruit_Basket_Column (irrespective of whether these baskets contain other fruits). Ideally I'd like to accomplish this in the table 'dimension' function, perhaps a combinations of 'Contains' and some string function?? Help! Thanks.
Take a look at my example below.
Baskets:
Load * inline [
Owner, Fruit_Basket_Column
Vegar, "Apple, Orange, Banana"
Rob, Kiwi
Hannah, "Orange, Apple"
Arvind, "Banana, Kiwi"
Siw, Apple];
Desired_Table:
Load
Fruit_Basket_Column,
Subfield(Fruit_Basket_Column, ',') as Fruit
Resident Baskets;
Take a look at my example below.
Baskets:
Load * inline [
Owner, Fruit_Basket_Column
Vegar, "Apple, Orange, Banana"
Rob, Kiwi
Hannah, "Orange, Apple"
Arvind, "Banana, Kiwi"
Siw, Apple];
Desired_Table:
Load
Fruit_Basket_Column,
Subfield(Fruit_Basket_Column, ',') as Fruit
Resident Baskets;