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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Calendar4thQtr for previous year

Status
Not open for further replies.

jrcol12357

Programmer
May 9, 2007
39
US
Using CRXI I wish to report on the previous quarter. How do I handle the 4th quarter of last year when the report is run in 1st quarter of the new year? I belive what I have will not look at the previous calendar 4th quarter.
if currentdate in Calendar1stQtr then {VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in Calendar4thQtr else
if currentdate in Calendar2ndQtr then {VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in Calendar1stQtr else
if currentdate in Calendar3rdQtr then {VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in Calendar2ndQtr else
{VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in Calendar3rdQtr

In searching for a solution all Calendar4thQtr is based on the current year.
 
To turn the current date into a date in the last quarter, try
Code:
DateAdd ("q", -1, currentdate)
You should be able to use this in your existing test, I think, though I don't normally use quarters.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I found this works best in giving a 4th quarter date range for the previous year.
if currentdate in Calendar1stQtr then {VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in
(dateadd("m", -3, ((date(year(currentdate), month(currentdate),01)-1)))+2 to
dateadd("m", -1, ((date(year(currentdate), month(currentdate),01)-1)))+2) else
if currentdate in Calendar2ndQtr then {VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in Calendar1stQtr else
if currentdate in Calendar3rdQtr then {VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in Calendar2ndQtr else
if currentdate in Calendar4thQtr then {VW_RPT_P688_UNION_d.DISBURSEMENT_DATE} in Calendar3rdQtr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top