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!

Summing charges over date ranges

Status
Not open for further replies.

PhilipOfOrange

Programmer
Dec 28, 2000
19
US
I am having trouble using range operators with date fields. I have not been able to find any examples of this in the help files.

I realize that I am replacing, (in the SUM function) what would normally be a reference to a group, with another type of expression, so there are multiple problems with my approach.

What I am trying to do is best expressed in the following:

SUM({table.currencyField}, upFrom {table.LastStatementDate})

This, of course, does not work. Any suggestions?

I also would like to be able to SUM with a double ended date range, as follows:

SUM({table.currencyField}, {table.LastStatementDate}-30 To {table.LastStatementDate}-1)

If that doesn't make sense to you, what I mean is a range
from 30 days before the last statement date to the day before the last statement date.

Thanks for your help

Phil Means


 
You could use a Running Total for this with the Evaluate
option set to the appropriate date range condition.

hth,
- Ido ixm7@psu.edu
 
Two alternatives to Ido's suggestion are:

1)you could use a formula:
If {datefield} in {date1} to {Date2} then {amount} else 0
Then sum this formula field.


2)You could simply sum the database field itself, and restrict the records on your report to only those in the desired date range with your record selection formula.

Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top