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!

Calculating totals 1

Status
Not open for further replies.

dsartain

IS-IT--Management
May 14, 2003
4
GB
I have a report that displays info for the past 6 weeks to last sunday although over all there is 16 weeks worth of data within the report

When I try to run a total for the past 6 weeks the data return is for the whole 16 weeks. Can anyone help me with a formular to just pull the totals for the past 6 weeks to last sunday.

Thank you
 
Are you conditionally suppressing the other 10 weeks worth of data?

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Assuming Crystal 8.5, you need to do it in three stages:

First, find last Sunday, based on the current date. A formula field called Last_Sunday, with code like:
If DayOfWeek(CurrentDate) = 1
then CurrentDate
If DayOfWeek(CurrentDate) = 2
then DateAdd("d", -1, CurrentDate)
If DayOfWeek(CurrentDate) = 3
then DateAdd("d", -2, CurrentDate)
and so on.

Next, another formula field called Limit_Date, found by subtracting six weeks, or rather 42 days
DateAdd("d", -42, Last_Sunday)

Finally, use Limit_Date to exclude anything earlier



Madawc Williams
East Anglia
Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top