Forum Discussion

ifenek's avatar
ifenek
Frequent Visitor
4 years ago

Projected stock calculation help

Hello, 

 

I need help, I'm trying to implement a stock projection calculation in place. 

What I'm looking to do is to say if I have enough stock to despatch a product. For that i'm looking at previous orders for the same product. If the due date of the despatch is the same the idea is to look at the earliest activationdate to determine an order. 

I have a column showing the available stock for the particular product. This value should be decreasing in regards of the previous orders and not stay the same like it is right now. 

 

I've attached a sample file as well as an excel spreadsheet with the calculation I'd like to achieve 

 

https://we.tl/t-g9aFPxZqwt

 

 

1 Reply

  • Hi ifenek ,

     

    Trythe follwoing code:

     

    Result =
    SUM ( Example[availableforassembly] )
        - IF (
            SELECTEDVALUE ( Example[duedate] )
                <= MAXX (
                    FILTER ( ALL ( Example ), Example[duedate] < MAX ( Example[duedate] ) ),
                    Example[duedate]
                ),
            SUM ( Example[remaingquantity] ),
            CALCULATE (
                SUM ( Example[remaingquantity] ),
                FILTER ( ALL ( Example ), Example[duedate] < MAX ( Example[duedate] ) )
            )
        )

     

    Be aware that this may need some changes, because I'm not sure if I understood your requirements especially on getting the previous value.