I have a dataset where I finding very to difficult to calculate rows
Example:
| Fund | amount | prior year amount | type |
| ABC | 123 | 145 | Investment |
| ABC | 145 | 156 | Total |
| LMN | 1456 | 15 | Investment |
| LMN | 159 | 23 | Total |
| XYZ | 456 | 56 | Investment |
| XYZ | 23 | 14 | Total |
In About all, I have to find a difference in investment and total (Type column)
| Fund | amount | prior year amount | type |
| ABC | 123 | 145 | Investment |
| ABC | 145 | 156 | Total |
| ABC | -22 | -11 | Difference |
| LMN | 1456 | 15 | Investment |
| LMN | 159 | 23 | Total |
| LMN | 1297 | -8 | Difference |
| XYZ | 456 | 56 | Investment |
| XYZ | 23 | 14 | Total |
| XYZ | 433 | 42 | Difference |
I am not sure if it will be easy to transpose and do it or it should be done easily in row formula