Alteryx Designer Desktop Discussions

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

calculate sum by transaction number and order number

Jocelynupup
7 - Meteor

Hi team,

 

I am currently working on the workflow. The rule is to sum the price for the same transaction number and for the same order number. Negative prices indicate a return. But I just realize there is a trick. A transaction number might have multiple order numbers. And an order number might have multiple transaction numbers. When we do the sum, we cannot sum the duplicate part (8051.8). Do you have any suggestions on how to do this?

 

The data is below. 

transaction numberorder numamt
56911303798051.8
5749130379-162.09
56911303808051.8
5750130380165.14
575213038024.27
5856130380-165.14
56911303788051.8
5714130378-359.12
5751130378-24.27
780511399168.05
7811113991204.16
02221765483183.2
02221765473183.2
00401506365013

 

The result is below.

8051.8+-162.09+165.14+24.27+-165.14+-359.12-24.27=7530.56

transaction numberorder numamttotal order amt
56911303798051.87530.56
5749130379-162.097530.56
56911303808051.87530.56
5750130380165.147530.56
575213038024.277530.56
5856130380-165.147530.56
56911303788051.87530.56
5714130378-359.127530.56
5751130378-24.277530.56
780511399168.05272.21
7811113991204.16272.21
02221765483183.23183.23
02221765473183.23183.23
004015063650135012.97

 

5 REPLIES 5
alexnajm
18 - Pollux
18 - Pollux

Use a Summarize or a Unique to remove the duplicates, and then Summarize to get the total - then you can Append it back to the original!

Jocelynupup
7 - Meteor

Sorry, my data is not completed. I expanded my original data. The data need to be grouped by transaction number and order number.

alexnajm
18 - Pollux
18 - Pollux

There is no way to know which transaction goes to which group based on the data provided - for example, what column can be used to know which group is which? It cannot be transaction number

 

transaction numberorder numamttotal order amt
56911303798051.87530.56
5749130379-162.097530.56
56911303808051.87530.56
5750130380165.147530.56
575213038024.277530.56
5856130380-165.147530.56
56911303788051.87530.56
5714130378-359.127530.56
5751130378-24.277530.56
780531399168.05272.21
7811113991204.16272.21
02221765483183.23183.23
02221765473183.23183.23
004015063650135012.97

 

CoG
14 - Magnetar

I do believe this can be done, assuming I understood the problem correctly! Check out this video for details on how the solution works:

https://youtu.be/rP_381tztzs

 

Hope this helps and Happy Solving!

In this series we answer questions from the Alteryx Community Forum to demonstrate how to frame problems and approach solving them using Designer Desktop. In this case, we highlight the power of Iterative macros to group all records that contain matching values in at least one field. I've seen ...
Jocelynupup
7 - Meteor

Hi CoG,

 

Do you have any ideas why the following dataset doesn't work?

POS                         ORDER
1012405606561790 SB012497606568166
1012406606562560 RB012497606568165
1012406606562560 SB012497606568166
1012406606562562 SB012497606568166
1031201606569427 RB012497606568165

 

They should have had the same groupID based on the logic.

 

Thanks,

Jocelyn

Labels
Top Solution Authors