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!

Multiple Date Parameters In Same Report

Status
Not open for further replies.

DKirksgirl

Technical User
Feb 22, 2001
12
0
0
US
I am working on a report where I have to extract data in the following format:
___________________________________________________________

YTD 2000 Total

January 2001 MTD Total
February 2001 MTD Total
March 2001 MTD Total
April 2001 MTD Total
May 2001 MTD Total

6/1/01
6/2/01
6/3/01
6/4/01 and so on for the month

YTD 2001 Total
___________________________________________________________
So basically, reviewing above I need a Total YTD for last year, and MTD totals for previous month of this year, and if current month, give detail by day.

Can you help?
 
You can create separate conditional totals for each period you need, and then total each formula. One example would be:

If {date} in MonthToDate
then {quantity}
else 0 Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 

Create 3 formulas and name them Year, Month & Day

Add the respective code to each:
Year({YourDateField})
Month({YourDateField})
Day({YourDateField})

Insert 3 Groups based on these formula fields Year, Month & Day

Add the field you want to total to the detail line

Right click on the field and goto Insert>Summary...

Select Sum from the dropdown and sort and group by Year from the dropdown

Check the 'Insert summary fields for all groups'

Suppress the detail line

Goto Format Section
For the Group Footer #3: - @DayA section click on the Formula icon next to Suppress and add the following.

Date (Year ({YourDateField}), Month ({YourDateField}), 1)
<>
Date (Year (CurrentDate), Month (CurrentDate), 1)

For the Group Footer #2: - @MonthA section click on the Formula icon next to Suppress and add the following.
Year ({YourDateField}) <> Year (CurrentDate)

Suppress each Group header and the detail line

The above is based on the assumption that you have multiple records per day. If you have a single record per day then it would be a little different

Hope this helps,

Jase
 
I forgot..in your Record Selection formula add:

{YourDateField} >= DateValue (Year (CurrentDate) - 1, 1 ,1 )


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top