Free Trial

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. Do you have any suggestions on how to do this?

 

The data is below. 

 

transaction numberorder numberprice
1A5
1B6
1C3
2A1
3D3
3E2
4F1
5G2
6G-4
7H5

 

The result is below:

transaction numberorder numberpriceSUM
1A515
1B615
1C315
2A115
3D35
3E25
4F11
5G2-2
6G4-2
7H55

 

Thanks,

Jocelyn

5 REPLIES 5
binuacs
21 - Polaris

@Jocelynupup can you explain the calculation for transaction no 2?

Jocelynupup
7 - Meteor

Sure. that's also the biggest challenge for me.

The order number of transaction number 2 is A, which is the same as transaction number 1. So sum=5+6+3+1=15

transaction numberorder numberpriceSUM
1A515
1B615
1C315
2A115
cpet13
11 - Bolide

@Jocelynupup I think this does what you want

cpet13
11 - Bolide

I made a small tweak that gets you closer. It's not exact, but it gets you close.

cpet13
11 - Bolide

@Jocelynupup haha, sorry, it took a little tweaking. But I think I finally got the final solution you are looking for!

Labels
Top Solution Authors