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

Summing up 3 Columns into new Column

Status
Not open for further replies.

Preetham16

IS-IT--Management
Dec 28, 2006
32
DE
Hello Gurus!

I need to add the values of the column DOC PHAR AND CLINIC and put the value in TOTAL ... Can anyone give a formula for this please?


Date Doc phar Clinic Total
------------------------------------ -------
13.02.2006 2 0 1 3
14.02.2006 1 2 1 4
15.02.2006 1 2 1 4
16.02.2006 2 1 2 5
-------------------------------------- -------
Sum Total 6 5 5 16
--------------------------------------- -------
-------------------------------------------------
cheers
BVK
 
best way is to use a crosstab, it'll do the totals for you.
 
Do a formula field,
Code:
DOC + PHAR + CLINIC
Display it on the detail line. You should also be able to do a summary total for it (or else add the three totals you have).

That's assuming none of them can be null. If you had a null, one of the columns would be blank rather than zero, and you'd also get a blank for the total. If this were the case, you'd need to set up individual formula fields,
Code:
if isnull(DOC) then 0 else DOC
And likewise for the other fields.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you Deeya / Madawc...

DOC PHAR AND CLINIC are just Text fields, the data base field is *Desc* like the one Below which has DOC,CLINIC etc.,

DESC
---------
DOC
PHAR
CLINIC
PRAXIS
Department

Am reading the field Desc like the following

DIM artSum as Number
if {CDBPHAC_BP_GRP_T.DESCRIPTION} STARTSWITH "Doc" then
formula = artSum + 1
end if

DIM apoSum as Number
if {CDBPHAC_BP_GRP_T.DESCRIPTION} STARTSWITH "Clinic" then
formula = apoSum + 1
end if

These values am writing under the TEXT field of DOC PHAR etc., like below ...

Date Doc phar Clinic Total
------------------------------------ -------
13.02.2006 2 0 1 3
14.02.2006 1 2 1 4

Now I need the TOTAL in each ROW ... Could you please check if their can be any formula that I can use and drag it under the TEXT FIELD of TOTAL?

PS : Also could you please let me know if the FORMULA is correct? I cannot see my SUBREPORT after I generate the Report after I started using this FORMULAS


Regards
Bvk
 
Hello all,

Any Ideas please on the above question?

Thank you

Regards.
BVK
 
Better to use Crystal's own system of totals.

There are several ways to find totals: running totals, summary totals and variables. Right-click on a field and choose Insert to get a choice of Running Total or Summary. Or else use the Field Explorer, the icon that is a grid-like box, to add running totals.

Running totals allow you to do clever things with grouping and formulas. They also accumulate for each line, hence the name. The disadvantage is that they are working out at the same time as the Crystal report formats the line. You cannot test for their values until after the details have been printed. You can show them in the group footer but not the group header, where they will be zero if you are resetting them for each group.

Summary totals are cruder, but are based directly on the data. This means that they can be shown in the header. They can also be used to sort groups, or to suppress them. Suppress a group if it has less than three members, say. They default to 'Grand Total', but also can be for a group.

To get yourself familiar with the idea, try doing a test report with a summary total and a running total for the same field, placed on the detail line. You'll find that the running total increases as each line is printed, whereas the summary total has the final value all along.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top