Sunday, March 11, 2012

Date Formula Current Month +1

How can I limit a report so that it only shows where the selected date (for example dateX) is greater than month(currentdate)?

For example, this is March 2006 so I would want to show everything from April 2006 and out as far as the data goes.

I tried using the formula:

month(dateX) > month(currentdate)
but then I get don't get data from January and February of 2007.

If I use:
(month(dateX) > month(currentdate) or
year(dateX) > year (currentdate))
I get data from January 2001 etc.

Another problem is that this data needs to be in a cross tab so I can't just use section expert to supress records.

Can anyone help me??

Thanks,
Babs827I don't know wether it will work for you or not and might be you get better formula for that but just try this :

define new formula field : LAST_DATE like

DateAdd ("m",1 ,CurrentDate ) - DatePart ("d", CurrentDate)

And then in your report condition give DATEX > LAST_DATE

if it work out for you let me know

Best Luck|||Do you mean to put the formula below in the selction criteria?

WhileReadingRecords;
DateVar Last_Date;
Last_Date := DateAdd ("m",1 ,CurrentDate ) - DatePart ("d", CurrentDate);
DateX > Last_Date

I tried this and it says that a date is expected where this 'DateAdd ("m",1 ,CurrentDate ) - DatePart ("d", CurrentDate);' is located.

Is there another way to arrange it?|||Nope,

In crystal report go to INSERT -> FIELD OBJECT -> FORMULA FIELD and define new formula field LAST_DATE

and in LAST_DATE formula put :
DateAdd ("m",1 ,CurrentDate ) - DatePart ("d", CurrentDate)

and save it ...

Now right click on DATEX (Your date on crystal report which comes from any table or runtime) go to SELECT EXPERT and in FORMULA EDITOR write

DateX > @.Last_Date|||That seems to work great, Thank you so much!!!!|||Hi all

I went through thread
nice to see this

I am also struggling with same kind of stuff

My query is

I need to go back for one year from selected date range
month and date is fixed like 01/06(dd/mm) and year goes to previous year

i mean
if i selected daterange of 05/06/2006 - 06/06/2006 than i get the values of 01/06/2005-31/5/2006

thanks in advance|||u can you crystal report inbuild function INLAST365DAYS to take date range of 1 complete year

No comments:

Post a Comment