Hi I have two rows and I want to subtract it and keep the value in the next row
Input:
Fund | order | amount | Category |
ABC | 6 | 100 | Buy |
ABC | 6 | 50 | Sell |
LMN | 6 | 150 | Buy |
LMN | 6 | 200 | Sell |
ELM | 6 | 154 | Buy |
ELM | 6 | 148 | Sell |
I want to sum buy and sell
Output:
Fund | order | amount | Category |
ABC | 6 | 100 | Buy |
ABC | 6 | 50 | Sell |
ABC | 6 | 150 | Total |
LMN | 6 | 150 | Buy |
LMN | 6 | 200 | Sell |
LMN | 6 | 350 | Total |
ELM | 6 | 154 | Buy |
ELM | 6 | 148 | Sell |
ELM | 6 | 302 | Total |