Forum Discussion

gan5133's avatar
gan5133
Regular Visitor
8 years ago
Solved

Credits Assignment to Prior Purchase Invoices

Using Power Pivot, I've built a model that lists prior invoices, newest to oldest, and need to write a DAX formula that scans the purchase quantity and identifies the rows (quantity) that add up to t...
  • Zubair_Muhammad's avatar
    8 years ago

    Hi gan5133

     

    Try this Calculated Column

     

    Assigned =
    VAR CumulativeQty =
        CALCULATE (
            SUM ( Table1[Purchase Qty] ),
            FILTER (
                ALLEXCEPT ( Table1, Table1[NDC_AcctID] ),
                Table1[DateOfSale] >= EARLIER ( [DateOfSale] )
            )
        )
    RETURN
        IF ( CumulativeQty <= 7, "Assign", "Remove" )