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

Running a Report based on Date 1

Status
Not open for further replies.

cretanion

Technical User
Jan 28, 2002
53
US
I have to run a report based on yesterdays date. Currently the report date is setup for (currentdate - 1). If it is a Monday then the report will show no data, because it is looking for data for Sunday. I need to pull up data for Friday. What is the formula that if the day is a Monday, then it will set the currentdate back to a Friday?
 
The dayofweek() function returns a 1 (sunday) through 7 (saturday) so create a fomula:

//first line handles Mondays, the second Sundays, the last
//handles the rest.
if dayofweek(CurrentDate) = 2 then (CurrentDate-3) else
if dayofweek(Currentdate) = 1 then (CurrentDate-2) else
(Currentdate-1)
Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
Thanks for formula and as you know it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top