R
Raul Sousa
I have this kind of table
Code Date Qty Value Amount
A N 1 5 5
A N+1 -2 Y
B N 2 3 6
The first Qty for a given code is always positive.
It is ordered by code them by date.
If Qty is negative I want Value (Y) to be Equal to the preceding value (5).
In other words if Qty is negative, Value (Y) must be equal to the value
corresponding to the last positive Qty (5).
I’m thinking of using DLast function in a subquery. More or less like this
Dlast(“valueâ€;â€Tableâ€;Code=Code and Date<date)
The problem is that I have not enough knowledge to make it work. Any hint
will be most welcome.
Code Date Qty Value Amount
A N 1 5 5
A N+1 -2 Y
B N 2 3 6
The first Qty for a given code is always positive.
It is ordered by code them by date.
If Qty is negative I want Value (Y) to be Equal to the preceding value (5).
In other words if Qty is negative, Value (Y) must be equal to the value
corresponding to the last positive Qty (5).
I’m thinking of using DLast function in a subquery. More or less like this
Dlast(“valueâ€;â€Tableâ€;Code=Code and Date<date)
The problem is that I have not enough knowledge to make it work. Any hint
will be most welcome.