Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2016 : Report Design
Message Icon Topic: PrevQuarter Not Working Post Reply Post New Topic
Author Message
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 69
Quote BoltzGirl Replybullet Topic: PrevQuarter Not Working
    Posted: 03 Jul 2018 at 5:33am
I have two formulas that are not working that I am trying to pull the previous quarter dates by using a Beg Date and End Date formula:

BEG DATE:
dateVar EndMonth := Date(Year(DataDate),Month(DataDate),01)-1;

If {?Denied Date From} = Date(1800,01,01) Then
(Date(Year(EndMonth),Month(EndMonth),01))
else
if {?Denied Date From} = Date(1850,01,01) then
minimum(lastfullweek)
else
if {?Denied Date From} = Date(1900,01,01) then currentdate -1
else
If {?Denied Date From} = Date(1925,01,01) Then
Switch (Month(EndMonth) in 1 to 3,Date(Year(DataDate)-01,01,01),
Month(EndMonth) in 4 to 6,Date(Year(DataDate),01,01),
Month(EndMonth) in 7 to 9,Date(Year(DataDate),04,01),
Month(EndMonth) in 10 to 12,Date(Year(DataDate),07,01))
Else
{?Denied Date From}

****My end date is working fine****
END DATE:
If {?Denied Date To} = Date(1800,01,01) Then
Date(Year(DataDate),Month(DataDate),01)-1
else
if {?Denied Date To} = Date(1900,01,01) then currentdate - 1
else
if {?Denied Date To} = Date(1850,01,01) then
maximum(lastfullweek) else
If {?Denied Date To} = Date(1925,01,01) Then
Switch (Month(DataDate) in 1 to 3,Date(Year(DataDate),01,01),
Month(DataDate) in 4 to 6,Date(Year(DataDate),03,31),
Month(DataDate) in 7 to 9,Date(Year(DataDate),06,30),
Month(DataDate) in 10 to 12,Date(Year(DataDate),09,30))
Else
{?Denied Date To}
Always appreciate the help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 8937
Quote DBlank Replybullet Posted: 06 Jul 2018 at 6:08am
if you want the start date of the quarter prior to today's date try
dateadd('q',datediff('q',date(1900,1,1),today)-1,date(1900,1,1))
IP IP Logged
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 69
Quote BoltzGirl Replybullet Posted: 06 Jul 2018 at 9:24am
You are a GENIUS!! Thank you so much, it worked like a gem.
Always appreciate the help!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.