Alteryx Designer Desktop Discussions

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

How to group a row and divide values

NY2BOS
7 - Meteor

Hello all my data looks like this 

 

Sale OrderProductValue
1Printer 
1Printer 
1Printer$6,000
1Screen 
1Screen 
1Screen 
2Ink 
2Ink$500
2Ink 

 

For sales order 2 it makes sense because the ink is $500 and i do a unique view. But for sales order 1 I'm looking to group sales order count unique products then divide the value. In the end printer should have $3,000 and screen Should have $3,000.

 

Thank you in advance

4 REPLIES 4
tristank
11 - Bolide

Hi @NY2BOS 

 

We can use the summarize tool to aggregate by sale order, find the sum of the value and the count distinct of product. From there we use the formula tool to calculate the sum divided by the distinct count of products. I have attached a picture and a sample workflow for you to download below. Please mark this as a solved solution if this helps and have a great day!

 

ny2 example.jpg

 

 

NY2BOS
7 - Meteor

@tristank thank you for the quick reply, using this flow can i get a view that looks like 

Sales OrderProductValue
1Printer3000
1Printer 
1Printer 
1Screen3000
1Screen 
1Screen 
2Ink500
2Ink 
tristank
11 - Bolide

You could although I'm curious how that structure would be valuable as it is a bit odd ha! 

 

1. Use the summarize tool to get the sum of the value grouped by sales order

2. Use the summarize tool to get the number of distinct products grouped by sales order

3. Use the formula tool to calculate the two i.e 6000 / 2 = 3000.

4. Take this data and join it to your original table on sales order

5. Create another formula that says if the value is not null then replace the value with the previous calculation (3000) otherwise leave the value column empty

 

Hope this helps!

axb210253
5 - Atom

That is a great explanation, thanks tristank !

Labels