Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello - I am trying to create a Sum expression based on two conditions - If Field A is distinct, and Field B is the same, sum the quantity. The example data set:
Matching | Matching1 | Quantity |
12345 | 68038986 | -310.000 |
12345 | 68038986 | - |
12345 | 68038986 | - |
56789 | 68038986 | -310.000 |
56789 | 68038986 | - |
56789 | 68038986 | - |
34567 | 68038986 | -310.000 |
34567 | 68038986 | - |
34567 | 68038986 | - |
98765 | 68038986 | -310.000 |
98765 | 68038986 | - |
98765 | 68038986 | - |
10293 | 68038986 | 310.000 |
10293 | 68038986 | - |
10293 | 68038986 | - |
28374 | 68038986 | 310.000 |
28374 | 68038986 | - |
28374 | 68038986 | - |
74563 | 68038986 | 310.000 |
74563 | 68038986 | - |
74563 | 68038986 | - |
57893 | 68038986 | 310.000 |
57893 | 68038986 | - |
57893 | 68038986 | - |
In this case, take distinct Matching value and Matching1 = Matching1, then sum the quantity. Using these conditions you would get a net zero quantity with this example.
I have the first part figured out, but not sure how to add the second condition where Matching1 is the same:
sum(aggr(sum(DISTINCT [Quantity]), [Matching]))
Any help is appreciated.
Please try:
sum(aggr(sum(DISTINCT [Quantity]), [Matching],[Matching1]))