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

Get date ranges thru parameter (previous year)

Status
Not open for further replies.

gc6294

IS-IT--Management
Feb 23, 2004
56
US
Anyone have ideas on how to do this. I need to create a report showing total sales by customer. The Report will only have 2 data columns, total sales in the current year up to date that the user enters in thru a parameter. The other column will have the total sales for the same date range in the previous year. I would prefer to not ask the user a ton of questions in the parameters. I was just hoping to query them ending date say 6/30/2007 and have the report get me data for date ranges 1/1/2006 to 6/30/2006 and another column 1/1/2007 to 6/30/2007. Any ideas? I would like to not hard-code in the 2006 and 2007 also...
 
Set up a parameter {?enddate} and then use a record selection formula like:

{table.date} in date(year({?enddate})-1,1,1) to dateserial(Year({?enddate})-1, month({?enddate}), day({?enddate})) or
{table.date} in date(year({?enddate}),1,1) to {?enddate}

Then create a formula {@year}:

if {table.date} in date(year({?enddate})-1,1,1) to dateserial(Year({?enddate})-1, month({?enddate}), day({?enddate})) then year({?enddate})-1 else
if {table.date} in date(year({?enddate}),1,1) to {?enddate} then year({?enddate})

Insert a crosstab and use {@year} as the column field and sum of sales as the summary. Then create a formula {@period} to show the date range used:

whilereadingrecords;
"For the Period January 1 to " + totext({?enddate},"MMMM dd")

Add this as another column field and then use the arrow keys to make it your column#1 field. Then go to the customize style tab->select {@period}->suppress subtotals.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top