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

Show data for previous day

Status
Not open for further replies.

kwirky

MIS
Apr 22, 2010
85
AU
Hello,
Am trying to create a report which compares currentdatetime data with data from the previous day.
I had success using the below formula, until today (1/6/2011)
(date(year(currentdatetime),month(currentdatetime),day(currentdatetime)-1))

Now I get an error which says "A day number must be between 1 and the number of days in the month"

The error explanation is as follows:
X-1 YesterdaysDate
EXP day(currentdatetime)-1;0
EXP month(currentdatetime);6
EXP year(currentdatetime);2011

Although I understand why I am getting an error, I do not know how to work around it. I will obviously encounter this problem each month.

Can anyone help with a suitable formula to counter this on CR 2008?
Thank you


 
You could change the formula to:

dateserial(year(currentdatetime),month(currentdatetime),day(currentdatetime)-1)

Or, why not just use:

currentdate-1

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top