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

sum() with division

Status
Not open for further replies.

acn242

IS-IT--Management
Nov 28, 2006
39
US
How do i get this to work?


Sum({InvoiceDetail.Quantity} / {Pricing.RxConverter})
 
YOu need to define level its to be evaluated. Report or group

If Report

Sum({InvoiceDetail.Quantity})/sum({Pricing.RxConverter})

Gouup
Sum({InvoiceDetail.Quantity}, {groupField})/sum({Pricing.RxConverter}, {groupField})

If the RXConverter sum can be zero you must test first

If sum({Pricing.RxConverter}) = 0 then 0 else
Sum({InvoiceDetail.Quantity})/sum({Pricing.RxConverter})

Ian
 
Create a formula {@div}:

{InvoiceDetail.Quantity} / {Pricing.RxConverter}

Then place it in the detail section and right click->insert sums on it at whatever report level you wish.

-LB
 
well my original sql was like this:

select i.code, sum(invd.quantity/p.rxconverter) as cases_shipped
from c02.invoicedetail invd, c02.pricing p
where 'link tables'
and invd.tobillon between 'somedates'
group by i.code

i want group level, and i cannot insert a sum on a created function

no zero's in data
 
Why show the SQL? Are you using a command to return the data?

What do you mean by a "created function"? Have you tried any of the solutions suggested above?

Software Sales, Training, Implementation and Support for Macola, Synergy, and Crystal Reports. Check out our Macola tools:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top