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

Show previous 24 hours (weekend issue)

Status
Not open for further replies.

kwirky

MIS
Apr 22, 2010
85
AU
Hi,
I need to create a report which shows previous 24 hours data (without adding parameters, so it runs for this period automatically wheneber the report is run (no user input)), but if the previous 24 hours contains a weekend, then for the previous Friday.
What I want to show is the number of jobs created in the past 24 hours, and I think I need an if-then-else formula, but do not know how to do this.
We are using CR Xi. Can anyone advise what the formula would look like? I will then need to repeat this for 12 months before.
 
You need the day of the week, that's
Code:
DatePart ("w", {date1})
Put this as a formula field and it gives a number, 1 to 7. The default is Sunday as 1 and Saturday as 7, though you can change this using firstDayOfWeek.

You could create another formula field that is set to 24, 48 or 72 hours, depending on the day of the week. Subtract this using DateAdd for hours. (Use HELP for the format if you don't already know it.)

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top