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.

Adding new rows based on a variable

lf7988
5 - Atom

Hello! I currently have a dataset (like below). It lists sales of certain product categories by customer location. It does not list rows for product categories for which customers are NOT selling a category today. (For example, in table below, you will see Location 2 does not sell Pants or Shirts so no rows for that appear.) 

 

AccountLocationCategoryTotal Location SalesLocation Category Sales
Retailer ALocation 1 Shoes$102.00
Retailer ALocation 1 Shirts $105.00
Retailer ALocation 1 Hairpieces$101.50
Retailer ALocation 1 Pants$101.50
Retailer ALocation 2 Shoes$73.00
Retailer ALocation 2 Hairpieces $74.00
Retailer ALocation 3 Shirts $157.00
Retailer ALocation 3 Hairpieces$156.00
Retailer ALocation 3 Pants$152.00

 

I would like to have output like the following (bolded rows/column are additions) -- essentially, each location would have a row for ALL categories, whether or not they are selling today and then I can add a T/F column indicating whether the product is being sold. 

 

AccountLocationCategoryTotal Location Sales Location Category SalesSelling Category?
Retailer ALocation 1 Shoes$102.00Y
Retailer ALocation 1 Shirts $105.00Y
Retailer ALocation 1 Hairpieces$101.50Y
Retailer ALocation 1 Pants$101.50Y
Retailer ALocation 2 Shoes$73.00Y
Retailer ALocation 2 Shirts $7N/aN
Retailer ALocation 2 Hairpieces$74.00Y
Retailer ALocation 2 Pants$7N/aN
Retailer ALocation 3 Shoes$15N/aN
Retailer ALocation 3 Shirts $157.00Y
Retailer ALocation 3 Hairpieces$156.00Y
Retailer ALocation 3 Pants$152.00Y

 

Any guidance in how to get there is much appreciated!! 

 

 

4 REPLIES 4
PhilipMannering
16 - Nebula
16 - Nebula

HI @lf7988 

 

Think this does the job,

PhilipMannering_0-1606680410736.png

 

Thanks,

Phil

PhilipMannering
16 - Nebula
16 - Nebula

The strategy here is to generate all combinations by Summarizing and Appending together. And then using The Join Tool to see what doesn't match. and Unioning on what falls out. Hope this makes sense.

lf7988
5 - Atom

Yes, it does, thank you so much!! I am going to try this out today or tomorrow and will let you know if any issues. Appreciate it! 

Qiu
21 - Polaris
21 - Polaris

@lf7988 

Tried a different approach and a bit more dynamic.

1130-lf7988.PNG

Labels