Forum Discussion

PowerBITestingG's avatar
PowerBITestingG
Resolver I
3 years ago
Solved

Inventory DAX First in First out

So I basically want to compute a formula that calculates the Current Quantity -   Delivered quantity of the MAX(Delivered date) and then do it again for the next one until the Current Quantity gets d...
  • Bifinity_75's avatar
    3 years ago

    Hi PowerBITestingG , try this calculate column: Name of column:"Table_"

    Formula = var cumulative=CALCULATE(SUM(Table_[Delivered Quantity]),
    FILTER(ALLEXCEPT(Table_,Table_[Item ID]),
    Table_[Delivered Date] >= EARLIER ( Table_[Delivered Date] )))
    return
    if(Table_[Current Quantity]-cumulative<0,0,
    Table_[Current Quantity]-cumulative
    )

    Best regards