Retail data identify the most recent purchase by CustID
I have a table, CustID, Date of Purchase, ProdID, Quantity
Now I want to add few more columns identifying the most recent purchase done by same customer for that ProdID and its quantity. This will help me identify number of days since last purchase for a product.
Re: Retail data identify the most recent purchase by CustID
You'll have to make sure the data is loaded in the correct order and then use the peek() function your load script to look at the previous record's value for [Date of Purchase] and use that for [PrevDtOfPur] .