Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Impromptu return only 1 row per product

Status
Not open for further replies.

kdemulder

IS-IT--Management
Mar 10, 2004
33
BE
I am making a report about an order containing multiple products. These products have multiple prices with in accordance multiple dates which reflects when these prices became effective. In this report I only need the most recent prices for every product. It ain't a problem to get the most recent date (max(date)), it is however a problem for me to filter out ONLY that line containing the most recent date with it's price for every product since it still gives me all the prices that existed for each product.
Can somebody tell me how I return only one row per product, with the most recent price?

(Everything in the report is ok, I only get multiple prices and dates for every product and I need only one row per product with the most recent price).

Thx in advance!
 
Write the following calculation:
Max (If(Date = Max(Date)) then Price else NULL)

This will only return a Price when the date for the record is the most current date. Then it will return the max of Price vs Null, which will always be Price. Not the most efficient way to accomplish things, but based on your explanation it's the best way I know.

Pain is stress leaving the body

DoubleD
 
Yeah, that's the best result I got on my screen so far. Thanks for that. Nasty little problem.
Ah well... That's how they'll get it at the end of the hall. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top