Hi All
I have been tasked to come up with a system to predict when we will begin to use a new batch of material and how much will be left over when we do.
This will have to be applied to a number of products but I am starting out with 1 to see if the system works.
I have the usage of the product in months, the stock and the number of batches:
Record ID | Material | Batch | Stock amount | Use Mth 1 | Mth 2 | Mth 3 | Mth 4 | Mth 5 | Mth 6 |
1 | A1 | [Null] | 2 | 3 | 2 | 4 | 6 | 3 | |
2 | A1 | EU55 | 10 | ||||||
3 | A1 | EU66 | 20 |
Ideally this is what I would like the output to look like:
Record ID | Material | Batch | Stock Amount | Use Mth 1 | Mth 2 | Mth 3 | Mth 4 | Mth 5 | Mth 6 |
1 | A1 | [Null] | 2 | 3 | 2 | 4 | 6 | 3 | |
2 | A1 | EU55 | 10 | 8 | 5 | 3 | -1 | ||
3 | A1 | EU66 | 20 | 16 | 10 | 7 |
The usage per month is subtracted from the stock amount for the first batch, until it reaches a minus figure (which means there isn't enough) and then it switches to using the next batch and then carries on with that one.
There could be more than 2 batches and there will be multiple materials (identified by different material numbers) but I thought I would start out with the easiest scenario.
Hope its not too difficult!