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

Show current and previous year's data

Status
Not open for further replies.

shannonlp

Technical User
Feb 9, 2006
163
US
I have a report that has a parameter on a date field (invoice_date). The report lists details like customer, invoice amount, etc. The invoice amount is summed at the customer level group to show the total invoice amount for the period entered in the parameter.

The user is asking have another field added next to the total invoice amount that will show the total invoice amount for the same period for the previous year. For example, if the report is run for 8/1/09 to 8/17/09 the results should show the total invoice amount for that date range as well as the total invoice amount for 8/1/08 to 8/17/08.

Any suggestions/help would be greatly appreciated. I’m on Crystal XI R2.
 
you would need to use something like this formula in your record selection group to bring in the data you need:
Use this for the selection criteria to bring in all the information you need
(
{invoice_date} >= {?startdate}
and
{invoice_date} >= {?stopdate}
)
or
(
{invoice_date} >= date(year({?startdate})-1,month({?startdate}),day({?startdate}))
and
{invoice_date} >= date(year({?startdate})-1,month({?startdate}),day({?startdate}))
)

From there you will have to use grouping and suppression to get the invoice to look like what you need. See if that gets you started.

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Hi,

Thanks for the feedback. To me it seems like a formula field needs to be created to display the correct amount. Currently I have invoice_amt displayed (then summed at the group level). The invoice amounts displayed are those that fall within the current data range. An additional field (formula field?) needs to display the invoice amounts for the same date range – 1 year.

Thanks again.
 
Actually, this does what I need it to do:

{INVOICE.INVOICE_DATE} in {?Start Date} to {?End Date}
or
({INVOICE.INVOICE_DATE} >= date(year({?Start Date})-1,month({?Start Date}),day({?Start Date}))
and
{INVOICE.INVOICE_DATE} <= date(year({?End Date})-1,month({?End Date}),day({?End Date})))

Thanks again for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top