Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Community,
Hopefully you will be able to help with this one. I need to calculate number of months that Projected Total Stock in the table below can cover. In this example the projected stock is available from July till September. Therefore the coverage in July should be 3 months, August - months ,September - 1 month and from October - 0 as shown in the column Months covered in the table below.
Data Month - Year | Material Number | Projected Total Stock | Months covered |
01.07.2023 | 153815 | 1152750 | 3 |
01.08.2023 | 153815 | 1152750 | 2 |
01.09.2023 | 153815 | 1152750 | 1 |
01.10.2023 | 153815 | 0 | 0 |
01.11.2023 | 153815 | 0 | 0 |
01.12.2023 | 153815 | 0 | 0 |
01.01.2024 | 153815 | 0 | 0 |
Thank you!
I can suggest a way. Sort the table in reverse order based on date.
If(Material = Peek(Material) and Projected_Stock > 0, RangeSum(Peek(Months_covered) + 1), 0) as Months_covered
Then if you want in previous order, then again reverse the order of the table based on date.
Based on this idea, if you can solve it in better way, please post it here.
I can suggest a way. Sort the table in reverse order based on date.
If(Material = Peek(Material) and Projected_Stock > 0, RangeSum(Peek(Months_covered) + 1), 0) as Months_covered
Then if you want in previous order, then again reverse the order of the table based on date.
Based on this idea, if you can solve it in better way, please post it here.