Forum Discussion

Sasi_2108's avatar
Sasi_2108
New Member
7 months ago
Solved

Help Needed: Replicating Recursive Excel Depletion Logic in DAX (Running Total with Conditional Sub)

Hello Community, I am trying to replicate a complex inventory allocation logic from Excel into Power BI. I have a dataset where I need to subtract "Pre-allocations" from a "Starting Quantity," but w...
  • Anonymous's avatar
    Anonymous
    7 months ago

    Hi Sasi_2108 ,
    Thanks for clearing that up, that’s exactly how the solution works. It doesn’t just match totals at the Key level; it actually splits the AddPriorityQty across each line item in order, based on the running Pre-alloc quantity. For each Key, the model goes row by row, checks how much of the priority quantity has already been used, and then gives each row either its Pre-alloc amount or whatever’s left. This way, the allocation happens line by line and stops when the pool runs out, just like the Excel logic the business is used to.