Joined: 27 May 2011
Online Status: Offline
Posts: 1
Topic: Most recent date - multiple variables Posted: 27 May 2011 at 7:47am
I am pulling sales data by part number. I need to also retrieve (from a different table) the lsit price for each part number. However the list price table contains multiple records for each part (our list prices get updated every year so there is an entry for 2011, 2010, etc). I need to pull only the most recent price for each part. My problem has been that not every part gets a new price every year (otherwise I could filter on effective price date > 12/31/2010), so the most recent price for 1 part might be 1/1/2011 while for the next part it might be 6/1/2009. How can I pull only the most recent list price based on effective date?
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 31 May 2011 at 3:17am
A standard anwer could be use a stored procedure, as you have the flexibility to find the correct value.
Using a straight table join... I don't really know. the idea that I have is to sort based on the date and take the first value, but I don't see it clearly.
That is what I would try at least, it may or may not be successful.
Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Posted: 31 May 2011 at 4:49am
what happens if you create a maximum price formula ( presuming the price only increases and never decreases... you could create a group by date, group by day, and sort it so you get the max date. if you place the amount in the date group does it successfully pull the max price as well???
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum