Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sum summary operation is displaying count Post Reply Post New Topic
Author Message
jbillens
Newbie
Newbie


Joined: 12 Mar 2012
Online Status: Offline
Posts: 5
Quote jbillens Replybullet Topic: Sum summary operation is displaying count
     Posted: 12 Mar 2012 at 4:22am
I have a crystal report that displays data from a datatable. I need to be able to summarise on of the columns by adding all the values for the particular group. When I add the sum operation it gives me the count instead of the group sum. From what I have read this could be due to crystal reports converting everything to string. How do I fix this?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Mar 2012 at 4:36am

use a formula field to convert your string to a numeric value and then sum that formula field (at the group level)

tonumber(table.field)


Edited by DBlank - 12 Mar 2012 at 4:37am
IP IP Logged
jbillens
Newbie
Newbie


Joined: 12 Mar 2012
Online Status: Offline
Posts: 5
Quote jbillens Replybullet Posted: 12 Mar 2012 at 4:42am

I have two formulas as follows:

ml:
ToNumber({paintstock.ml})
 
ml Sum:
Sum(@ml)
 
This results in ####### when I run the report.
 
I am very new to crystal reports and am unsure how to perform a sum operation at the group level. Could you elaborate on this for me please.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Mar 2012 at 4:46am
you cannot condtionally sum like that in crystal
you an use 3 approaches.
1 is to only convert the numbers for your IN statement in your original formula and sum that
//example here
if table.field in ['abc','xyz'] then ToNumber({paintstock.ml})
 
or you can use a Running total to conditionally sum records
or you can use variable formuals to conditionally sum records
IP IP Logged
jbillens
Newbie
Newbie


Joined: 12 Mar 2012
Online Status: Offline
Posts: 5
Quote jbillens Replybullet Posted: 12 Mar 2012 at 4:50am
Wow I am in way over my head with this. I must find a way to get it done however. First do you have any idea why the sum operation is displaying the count instead. And, secondly what approach would you recomend for a novice like myself. Are there any online tutorials that you would recomend.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Mar 2012 at 4:51am
sorry i think i misunderstood that you were trying to do here on your last post 
I thought you only wanted to sum on some records but not others.
the #### displays when your output string is not wide enogh to display the entire value. Expand it and it will show you the sum.
not that this is not an incrimental sum per row but the sum for all rows regardless of location in the report.


Edited by DBlank - 12 Mar 2012 at 4:51am
IP IP Logged
jbillens
Newbie
Newbie


Joined: 12 Mar 2012
Online Status: Offline
Posts: 5
Quote jbillens Replybullet Posted: 12 Mar 2012 at 4:58am

I am still getting counts and not sums. I want to have the sum of ml for each individual group. Both running total and sum give me the row counts.

The report preview is showing everyting as I intend it to be displayed.
 
What am I doing wrong?


Edited by jbillens - 12 Mar 2012 at 5:00am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Mar 2012 at 5:11am

Sum(@ml) will give you the sum for all records

SUM({@ml},{table.groupfield}) will give you the sum at the group level
 
to make it easier for you
go to the sigma button (the blue "E")
click on it
select the @ML formula field as the field to summarize
SUM as the calculation
Group 1 as the location (assuming that is the group you want values for)
hit OK
it will place a summary field in the GF1.


Edited by DBlank - 12 Mar 2012 at 5:16am
IP IP Logged
jbillens
Newbie
Newbie


Joined: 12 Mar 2012
Online Status: Offline
Posts: 5
Quote jbillens Replybullet Posted: 12 Mar 2012 at 5:14am
Ok I was doing everything write in crystal reports. I did not have the datatable column set up to be an int32. After doing this all works as intended. Thank you DBlank for you patience and help.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum