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

Need Help With Parameter

Status
Not open for further replies.

goduke

IS-IT--Management
Feb 13, 2006
65
US
I have a report that uses a Date Range as a Parameter. The user selects a Start of Range and an End of Range, and the report runs for that specific time period. (Completed_Date in ?DateRange)

My problem is, I need a sub report that shows summaries of the items in the main report, but the summaries have to be broken down as:
Previous Week
Previous 30 Days
Previous 60 Days
Fiscal Year to Date

I'm thinking of doing a sub report for each category, but I dont know what to put in my select criteria to get the correct dates, since the main report uses a parameter. Or do I even need to use any subreports? Any help would be great.
 
One subreport will suffice, and the record selection can be automated.

Keep in mind that your date periods may not prove intuitive though, if your fiscal year is 7/1 - 6/30, and the date is July 17, the past 30 and past 60 will be larger than the fiscal year.

Anyway, the record selection would be something like:

if currentdate > cdate(year(currentdate),8,31) then
{table.date} > cdate(year(currentdate),6,30)
else
{table.date} >= dateserial(year(currentdate),month(currentdate)-2,day(currentdate))

In either case the data returned will span the length required.

Then use Running Totals with the appropriate date filtering in the evaluate->use a formula to perform aggregates.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top