Forum Discussion

learner03's avatar
learner03
Icon for Post Partisan rankPost Partisan
4 years ago
Solved

Estimated Delivery date based on cumulative count

I have 2 tables- 1) Open Purchase Order- this table shows when are the items arriving in the warehouse based on ETA W/H date.  Date Document Number Shipment Header Item Code ETA W/H Quantit...
  • Greg_Deckler's avatar
    Greg_Deckler
    4 years ago

    learner03 OK, I simplified the equation and was able to eliminate the GENERATESERIES. Not sure why I didn't do it this way the first time. Try this one:

    FIFO 2 = 
        VAR __DaysToFulfill = 10
        VAR __ItemCode = [Item Code]
        VAR __Date = [Date]
        VAR __QtyToFulfill = SUMX(FILTER('BackOrders',[Item Code] = __ItemCode && [Date] <= __Date),[Backorder Qty])
        VAR __Table = FILTER('OpenPurchaseOrders',[Item Code] = __ItemCode)
        VAR __Table1 = 
            ADDCOLUMNS(
                ADDCOLUMNS(__Table,"__tqty",SUMX(FILTER(__Table,[ETA W/H] <= EARLIER([ETA W/H])),[Quantity])),
                "__LoopCounter",[__tqty] - __QtyToFulfill
            )
        VAR __TargetDate = MINX(FILTER(__Table1, [__LoopCounter] >= 0),[ETA W/H])
        VAR __FulfillmentDate = IF(__TargetDate = BLANK(),BLANK(),__TargetDate+__DaysToFulfill) 
    RETURN
        __FulfillmentDate