The current code written for the lead-time forecast analysis focuses on a supplier having one lead-time for an item. However, in the real situation, there are scenarios where lead-time can vary for the same product from the same supplier going to different locations (e.g. different manufacturing sites). The main driver can be the distance between the supplier and the different locations that it ship to. How can the code be updated to have lead-time by supplier by ship-to-location and by item?
Hello,
It is indeed very common to have distinct supplier lead times depending on the location to be served.
The usual way to take the differences into account into your data is :
- Having a SKU table and not only Item table
- If you have a Purchase Orders history with relevant data, then you can simply create a joint between [PO.Sku] and [Sku.sku]. We would recommend to have a probabilistic supplier leadtime (use ranvar()). If not possible, then take avg
Hope it helps
Thank you for the guidance. I am asking more from the code standpoint. The data is given with lead-time at the item-location level. I am thinking the easiest is to bring that data from Items table into the Vendors table to utilize the existing code.
With the existing code, I assume I need to add a location variable to the file to look something like:
Original:
Updated:
Then in any subsequent joins or filters, I will need to add the location filter. How would I update the following code to account for the location specific lead-time?
Taking the last line as an example, would it look something like ?
Hello s40racer,
Indeed if you use
Items.AnnouncedSLTValue = same(Suppliers.Leadtime) by [Suppliers.Supplier, Suppliers.Location] at [Items.Supplier, Items.Location]
, you would get for each item the value corresponding to the pair (Items.Supplier; Items.Location) adding the granularity that you wanted.However, this implementation implies that all items with the same pair (Supplier; Location) would have the same Lead-Time. If you want to have different Lead-Time for different items provided by the same supplier, you need to add the relevant Reference in the Suppliers table (both for your orignal case at item level and your updated one at SKU level)
Also looking at the original code:
It seems that your table Items has a primary dimension, which is also present in PO, allowing you to have natural aggregation on line 2,3 and 4.
If the primary dimension was previously at the Item level, you might want to change it to the SKU level (Item x Location). This way,
Items.SLT_ItemLevel
will be the distribution of observed Lead-Time for your specific SKU (versus for your specific Item previously).Hope it helps!
Thank you ToLok.
Are you able to modify the code or give a more explicit example on how to implement the code at the SKU level? From data standpoint, I assume the following fields need to exist in items, PO, and vendor tables: item #, destination location, and supplier ID, in order to implement the SKU level code?
Currently the partnering data has not been updated to such a structure. Only the Items table (Item Master) has the item #, supplier ID, and destination location. If the data structure noted above is needed to implement the SKU level code, I can make sure this is done.
Thank you.
Hello,
I had a look at your code.
First I created a Sku table that you can find in your CustomerName/clean/Sku.ion file. We will use this table as the item table as you want to compute things at Sku level and not Item level.
When I take the PurchaseOrders table, we want to do exactly the same thing, meaning create a Sku vector that is "MaterialSID x Location". The thing is that there are no location column in the PurchaseOrders table that indicate where the goods are received.
Once we have it, we will simply create a Sku vector in PurchaseOrders Table and then use the primary dimension [Sku] as the joint between the 2 tables Sku and PurchaseOrders
Best regards
Also, instead of using
by .. at
everywhere, you could declareSuppliers
as upstream ofItems
. This will remove the need forby .. at
option entirely. I am giving an example of the relevant syntax at: https://news.lokad.com/posts/647Hey! Thanks for your interest. I am not too sure which code you are referring to. Don't hesitate to include an Envision snippet (see https://news.lokad.com/static/formatting ) in your question to clarify what you are working on. You can also include a link to the Envision code playground (see https://try.lokad.com ) if you can isolate the problem.
The Lokad usually approach lead time forecasts to craft a parametric probabilistic model to be regressed with differentiable programming. This approach makes it possible, for example, to introduce a distance parameter in the model. The value of this parameter is then learn by regressing the model over the data that happens to be available. Conversely, if there is no data at all (at least for now), the value of the parameter can be hard-coded to a guestimate as a transient solution.
Then, this approach might be overkill if there is enough data to support a direct lead time
ranvar
construction over supplier-location instead of supplier.Let me know if it helps.