date Range parameter in Crystal

Hi All,   need help quick.

First I have a Date Range Parameter in my crystal report.   I use this parameter to determine if the Hours fall with in the date range.      Now I need to add a column that is Previous month.   Since this field is not actually a DATE field I can not use it in the DATEADD function.   So I stripped the field to a text field to give me the StartDate in a field Called StartDate.   This is a Formula field and Not defined as a DATE field.   So I can not use the StartDate in the DATEADD function to get the previous month.

So basically what I need is the the Previous month Range based on the parameter entered for the Date Range.   The parameter entered is always a single month.

this is urgent please help
InframapAsked:
Who is Participating?
 
bdreed35Commented:
You will need to open up your selection criteria to allow that data to be returned:

{table.date} in dateadd("m",-1,minimum({?Date Range})-day(minimum({?Date Range}))+1) to maximum({?Date Range})

This calculates back to the first day of the month prior to the start parameter date through to the end parameter date.
0
 
wykabryanCommented:
if it is always just one month the follow should work
your startdate formula:

date(cstr(minimum({?Parameter Daterange})))

Then another formula you are going to find the start of the new month and year
if month({@startdate}) = 1
    then date(year({@startdate})-1,12,1)
    else date(year({@startdate}),month({@startdate}),1)

I would then compare month and year of this formula to your record selection.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.