Forum Discussion
kaledjeff
8 years agoAdvocate I
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...
- 8 years ago
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 ) )
Zubair_Muhammad
8 years agoCommunity Champion
I think Phil_Seamark column should work.
Nevertheless try the following as well
First a MEASURE
Measure =
VAR myLastDate =
CALCULATE (
MAX ( 'Table1'[Purchase Date] ),
FILTER (
ALLEXCEPT ( Table1, Table1[Client] ),
'Table1'[Purchase Date] < SELECTEDVALUE ( 'Table1'[Purchase Date] )
)
)
RETURN
CALCULATE (
FIRSTNONBLANK ( 'Table1'[Purchase Order], 1 ),
FILTER (
ALLEXCEPT ( Table1, Table1[Client] ),
'Table1'[Purchase Date] = myLastDate
)
)
Zubair_Muhammad
8 years agoCommunity Champion
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
)
)