Forum Discussion

kaledjeff's avatar
kaledjeff
Advocate I
8 years ago
Solved

Previous Purchase

Hello,   I have a list of purchase orders for all of our customers. I would like to know how to get the previous purchase order for a customer.   Please keep in mind the numbers of purchase order...
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    kaledjeff

     

    Or this Calculated Column

     

    Column =
    VAR myLastDate =
        CALCULATE (
            MAX ( 'Table1'[Purchase Date] ),
            FILTER (
                ALLEXCEPT ( Table1, Table1[Client] ),
                'Table1'[Purchase Date] < EARLIER ( 'Table1'[Purchase Date] )
            )
        )
    RETURN
        CALCULATE (
            FIRSTNONBLANK ( 'Table1'[Purchase Order], 1 ),
            FILTER (
                ALLEXCEPT ( Table1, Table1[Client] ),
                'Table1'[Purchase Date] = myLastDate
            )
        )