I have the end dates of each quarter as the PK for a table, and I need to compare a date to see which quarter-ending value would be used in a calculation.
The Table looks like:
EndingDate Value
12/31/2012 $1,000
For example, given 3/1/2013 I would need to return 12/31/2012 and use that date to retrieve the $1,000 value.
Does anyone know what to use in MS Access 2007 to perform this? I tried:
DATEADD(dd, -1, DATEADD(qq, DATEDIFF(qq, 0, DATEINQUESTION), 0))
The calculation always uses the previous ending quarter's date, and the value associated with that date.