I have one database with Equipment ID’s and multiple Transaction Dates per ID:
Equipment ID Transaction Date
7557545 09/30/2016
7557545 05/24/2016
7557545 03/01/2016
7557545 12/13/2016
2112353 08/17/2016
2112353 07/24/2016
2112353 06/01/2016
I need to create a query to select the max date closest to (less than) a specific date, such as 6/30/2016 (the result would be the transaction dates bolded in the examples above). This would be really easy to do with two tables (use one to select all transactions less than 6/30/2016, then take that result and create another table select the max date grouped by Equipment ID. But the database has way too many lines to use this approach – there’s simply too much data. I need to find a way to do this in one query.
I set-up my query as follows:
Field: Equipment ID Transaction Date
Table: Database TableDatabase Table
Total: Group By Max
Sort:
Show: þ þ
Criteria: < “6/30/2016”
This doesn’t work because the Max selects the max date, regardless of whether or not it’s greater than 6/30/2016, then the Criteria eliminates it. So for the example at top, nothing would show for ID 7557545 because the 9/30 date is selected by Max, then eliminated by the Criteria. Any suggestions on how to correct this would be greatly appreciated!!