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

Narrow SUM of formula to one part number at a time 2

Status
Not open for further replies.

BigDogAZ

IS-IT--Management
Aug 18, 2006
6
US
The BASIC code below selects ISSUE and PICK transaction quantities that occur in 2010 and displays the actual qtys if true, or 0:

FORMULA NAME: YR2010-issues
dim YR2010issue as number
if ({ITEMH.TYPES}= "ISSUE" or {ITEMH.TYPES}= "PICK") AND Year({ITEMH.DAT_})= 2010 then
formula = {ITEMH.QTY}
else
formula = 0
end if

This works fine, but when I enter a range of part numbers (in my parameter field), instead of just one part number, the SUM statement below adds up ALL part numbers’ 2010 values:

FORMULA NAME: Total2010
Sum({@YR2010-issues})

I need it to SUM just the ISSUES and PICKS for 2010, for one part number at a time. Then the next, etc. What do I need to do to get sub-totals by part number?
 
Try using Crystal's automatic totals. If the report groupes by part number you could do a running total that included your test. Or have a similar formula at detail-line level and then use a Crosstab to sumarise it by part.

The use of Crystal's automated totals is outlined at FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Insert a group on part number and then place your formula in the detail section->right click on it->insert summary sum->at the part number group level.

-LB
 
THANKS TO BOTH MADAWC AND LBASS! You both offered a similar solution that solved my problem. I have been using Crystal for two decades (on and off), but since I haven't used it for two years, some features I forgot about. I was making it way too hard in creating formulas for my part number totals (sum). Your suggestions, the Insert Summary from the Insert menu (or from the right-click, Insert both led me to use that feature again. It was so easy! I had forgotten about it. After reading the suggested FAQs about Crystal's automated totals (there are so many choices!), Insert Summary seemed appropriate, and it was. Thanks guys! BigDogAZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top