Forum Discussion
Allocate correct PO from the Stock Table based on stock availability
- 2 years ago
Note: MDX2 has a higher index than MDX3.
This approach breaks down/will be unreliable when you dip below zero stock.
You have multiple references for the same TRANDATE. Neither Power Query nor Power BI guarantees a sort order. You must provide your own index column.
What should happen when a fitting is attempted while no stock is available?
- Anonymous2 years agoNot applicable
Thank you lbendlin. Yes, I have to use an index column. And in my calculation in Dax I am using that, but still don't get the correct allocation.
Good point that I have to deal with the situation there is no stock..
- lbendlin2 years ago
Super User
Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.- Anonymous2 years agoNot applicable
Hi Please see another example below:
Stock table:REFERENCE TRANDATE Sum of QUANTITY Index CumulativeQuantity MDX1 02/01/2024 1 1 1 MDX2 12/04/2024 2 3 4 MDX3 16/04/2024 1 2 2 MDX4 17/04/2024 7 4 11 MDX5 17/06/2024 2 5 13 MDX6 17/06/2024 2 6 15 MDX7 18/06/2024 1 7 16 MDX8 03/07/2024 6 8 22 MDX9 04/07/2024 1 9 23 MDX10 22/07/2024 2 10 25 Fitted Table, With The Expected PO Reference (allocating the available stock based on Qty available and Tran Date prior to the Call Date):
Call No Sum of Fit Index1 Call Date CumulativeFitted POReference 420X1 1 1 12/04/2024 1 MDX1 420X2 1 2 28/05/2024 2 MDX2 420X3 1 3 28/05/2024 3 MDX2 420X4 1 4 28/05/2024 4 MDX3 420X5 1 5 28/05/2024 5 MDX4 420X6 1 6 29/05/2024 6 MDX4 420X7 1 7 29/05/2024 7 MDX4 420X8 1 8 29/05/2024 8 MDX4 420X9 1 9 21/06/2024 9 MDX4 420X10 1 10 21/06/2024 10 MDX4 420X11 1 11 21/06/2024 11 MDX4 420X12 1 12 21/06/2024 12 MDX5 420X13 1 13 21/06/2024 13 MDX5 420X14 1 14 21/06/2024 14 MDX6 420X15 1 15 21/06/2024 15 MDX6 420X16 1 16 28/06/2024 16 MDX7 420X17 1 17 01/07/2024 17 MDX8 420X18 1 18 03/07/2024 18 MDX8 420X19 1 19 03/07/2024 19 MDX8 420X20 1 20 05/07/2024 20 MDX8 Please let me know if you have any questions. Thank you for looking into this!!