
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Subtract value from positions to zero
Hi,
I have a table of orders. The orders are divided into several desired dates with different quantities.
Orders
ID | desired date | amount |
100 | 31.01.2022 | 1.000 |
100 | 28.02.2022 | 1.000 |
100 | 31.03.2022 | 1.000 |
In another table I can see how much has already been delivered. However, the delivered quantity does not refer to the individual dates, but to the entire order.
Delivered
ID | delivery date | amount |
100 | 30.01.2022 | 1.000 |
100 | 28.02.2022 | 850 |
100 | 04.03.2022 | 50 |
Qlik should post the delivery quantity to the items until "0" is reached. Only then should the next position be booked.
The result should look like this:
ID | desired date | order quantity | delivered quantity | status |
100 | 31.01.2022 | 1.000 | 1.000 | closed |
100 | 28.02.2022 | 1.000 | 900 | open |
100 | 31.03.2022 | 1.000 | 0 | open |
Do you have an idea how this can be implemented?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have now found a solution. It's actually quite easy if you use the "Previous" function.
First it must be checked whether the previous record belongs to the current record. For example via an ID and the part.
Like:
ID = previous(ID) and Part = previous(Part)
In this way, you can add up the number of pieces ordered per item and offset against the total quantity delivered until you get to 0. Works perfectly!


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
doesn't make sense, in Feb total delivered is 850 but you want to include march figures into feb??
If a post helps to resolve your issue, please accept it as a Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That makes a lot of sense. Because it doesn't matter when it was delivered, but that the order is fulfilled. The order is not fulfilled until the quantity is reached. Even if the actual desired date was not reached. It is therefore quite possible that the goods will arrive later if there are delays in delivery. Delays in delivery should be known worldwide, especially during the pandemic.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have now found a solution. It's actually quite easy if you use the "Previous" function.
First it must be checked whether the previous record belongs to the current record. For example via an ID and the part.
Like:
ID = previous(ID) and Part = previous(Part)
In this way, you can add up the number of pieces ordered per item and offset against the total quantity delivered until you get to 0. Works perfectly!
