Reputation: 5
I have 2 tables. What I would like to calculate is the column *Received before CutoffDate. This column gives me the sum of everything that has been received on dates smaller or equal to the CutOffDate for that particular ItemNo.
If I isolate my tables to 1 ItemNo, I can calculate this but I have not found a way to do this in a general way because my TABLE 1 has hundreds of ItemNo.
TABLE 1
ItemNo | Total Received | PlanRcvDate |
---|---|---|
10560300 | 2 | 3/05/2022 |
10560300 | 4 | 28/04/2022 |
10560300 | 6 | 27/04/2022 |
30238543 | 1 | 1/05/2022 |
30238543 | 3 | 29/04/2022 |
30238543 | 5 | 28/04/2022 |
TABLE 2
ItemNo | CutOffDate | Received before CutOffDate |
---|---|---|
10560300 | 2/05/2022 | 10 (4 + 6) |
30238543 | 29/04/2022 | 8 (3 + 5) |
Upvotes: 0
Views: 364