Hi guys,
So I'm looking to create a query that will generate a dynamic report that sums each customer sales over the most recent 12 month window. As a new month of sales is completed, I need this query to add the most recent completed month, while dropping the last month in the range.
I have a SerialMonth field added to my Date Table that allows me to use numeric values to signify which months I want in a given range. For example, November 2011 is SerialMonth 206, and December will be 207.
Obviously if I want just a snapshot look at a range of 12 months I can include the criteria "Between 194 and 206" in the SerialMonth field to give me what I want, however when December rolls around I will have to manually edit that criteria to say "Between 195 and 207".
Is there a way through criteria or SQL to give me the most recent 12 Months? Perhaps the TOP 12 included in my SQL statement?
Any help is greatly appreciated!!
Bookmarks