date Range parameter in Crystal

Posted on 2006-06-08
Last Modified: 2008-03-03
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
Question by:Inframap
    LVL 16

    Assisted Solution

    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.
    LVL 28

    Accepted Solution

    You will need to open up your selection criteria to allow that data to be returned:

    {} 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.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now