Home

Resources
 
The Automatic Rolling Year!

Here is a statement where clause that I created to automatically get a rolling 12 month trend starting 2 months before the current system date.

dte>=((current_date - 14 months ) - day(current_date - 1 day) days)
and ddte<((current_date - 2 months ) - day(current_date - 1 day) days);
If the date is '04/01/1998' then the range will be >= '02/01/1997' and <'03/01/1998'

The Automatic Rolling Month!

Same dog, new day. This one gives you the previous calendar month!

dte>=((current_date - 2 months ) - day(current_date - 1 day) days) and dte<=((current_date - 1 month) - day(current_date) days);

If current_date was 3/5/1998 then

ddte>=((current_date - 2 months ) - day(current_date - 1 day) days)

evals to addte>='01/01/1998'

((current_date - 1 month) - day(current_date) days)

evals to addte<='01/31/1998'