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!

inserting a total for lastyearYTD?

Status
Not open for further replies.

jimwarren

ISP
Apr 12, 2003
7
0
0
US
i have a report, grouped by customer type that has
customertype, customer #, name, total of this year's sales(YTD)

i want to add a column that is a summary of last year's sales for the same time period...ie, LastYearYTD....

is it possible to do that with insert - field object - and a new sql expression or a new formula field?

something like ??
sum{sysoent.order_total} where {sysoent.order_date} in LastYearYearToDate

i havent been able to hit on something that works just yet...

 
Create a formula:

If {DateField} in LastYearYTD then {SalesAmount} else 0

Then perform a simple sum on this formula.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
A SQL Expression is the most efficient, here's an example using Oracle:

(select sum(ACTRANS.&quot;UNITS_AMOUNT&quot;) from &quot;LAWCVC&quot;.&quot;ACTRANS&quot; ACTRANS where ACTRANS.&quot;POSTING_DATE&quot; >= to_date('2003-01-01', 'YYYY-MM-DD') and ACTRANS.&quot;POSTING_DATE&quot; <= to_date('2003-12-31', 'YYYY-MM-DD'))

Note the trick is to use parens around the select.

When asking for technical information you'll receive better results if you give technical information, such as the Crystal/database version, example data and expected output.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top