Avatar of JerryFromSD
JerryFromSD
 asked on

Crystal Reports summary field generates a count, not a sum

I am using Crystal Reports for Visual Studio 2010. I create a group on a field to get a subtotal
for that group. When I choose the field to summarize on, I select "SUM" for Calculate the
Summary. The data comes from a data set and the field is defined as double. The result generated
is the "COUNT" not the "SUM." Please advise on how to get the "SUM." Thanks in advance.
Crystal ReportsDB Reporting ToolsVisual Basic.NET

Avatar of undefined
Last Comment
JerryFromSD

8/22/2022 - Mon
Mike McCracken

If you can select sum and select it, unless it somehow changed you are getting the sum.

Have you checked the summary to verify it wasn't changed somehow?

mlmcc
ASKER CERTIFIED SOLUTION
adriankohws

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
musalman

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JerryFromSD

ASKER
I have not solved the problem. Other fields that are printed within the group are non-numeric. The Employee code that is used to determine  a group is non-numeric. The field I want to subtotal on is numeric.
Thanks for the reply musalman. I do not know how to use the ToNumber field in this situation, can you please explain. Thanks Jerry
Mike McCracken

If the field is numeric you don't need it.

How are you choosing the field?
Is it on the report?

Where did you put the summary?
Have you right clicked the summary and tried to change it?
Does it show SUM or COUNT?

mlmcc
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
rgn2121

Is it possible to attach the report and tell us what column you are trying to sum?
adriankohws

Yes, mlmcc has spotted an important thing, did you put the summary field in the correct section of the report, if you put it wrongly, it won't work properly.
JerryFromSD

ASKER
Thanks for the reply. mimcc, I will aswer your questions as follows:
1. I do not understand your first statement.
2.When I create a new Crystal report and come to the grouping dialog, I select the Employee Code for "Group By". From the Summaries dialog, I select the amount field and choose "SUM".
3. In the Group Footer
4. Yes, Many times.
5. it shows "sum"
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Mike McCracken

My first statement was saying since you say it is a numeric field there is no need to use the ToNumber function to convert the field to a number.

Since it shows SUM are you displaying the numbers in the field?

Have you summed them to know what the answer should be?
It is possible for 5 numbers to add to 5

What are the values in the field that is being summed?

Are you filtering the data in any way?

Try this
Create a NEW report using the same data source
Drop the numeric field in the details section
Do a SUM summary on it.

mlmcc
JerryFromSD

ASKER
rgn2121, I could attach the report; but, let me explain where I think the problem is. I am producing the Crystal Report from a data set. I read Access Tables in VB.net and produce the Data set from the tables that I read. I create the Data set by going to Projects, Add New Item, Data, Dataset that creates a .xsd file.
I Add Datatable and then add the fields to the dataset. I click on a field and select properties to change the field to system.double for those fields that I want to be numeric. That creates the Dataset that I filll using VB.NET.
Mike McCracken

Are you creating the report against the XSD file or a table?

mlmcc
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
adriankohws

Very seriously, when you print the individual record, kindly check all the data, I strongly believed at least one of them is not NUMERIC. The dataset was pull from Access and I don't understand why you have to CHANGE a FIELD to system.double, unless at the first place, the FIELD wasn't a NUMERIC FIELD.
rgn2121

Let me make a suggestion since a do something similar except that I am pulling from Oracle tables.  Once you get your in memoery dataset and you are ready to report on it, I would recommend writing the schema of your dataset out and using that to build reports especially if they are not compiled reports.

I have a coworker that uses the method you described above and every time they add/remove a column or change a datatype, they have to do and manually alter that xsd in designer.  To me that can be tedious and prone to error.  What I prefer is to use the DataSet.WriteXmlSchema() method.  Once it writes out, I delete my old xsd and add an existing item to my project...the new xsd.  I then go to my reports and verify the database.  This way I know that what I am building my reports against is exactly what my dataset looks like.

Just a thought...
JerryFromSD

ASKER
I have the problem solved, I don't know how to award points; but, thanks to you all.

The problem was the data being presented to Crystal Reports from the dataset was not numeric even though it is defined as numeric in the dataset. I used CDBL in crystal Reports to insure I had numeric data.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
adriankohws

If you would to ask me, you can dedicate to myself and mlmcc, who are the ones telling you the numeric issue.
adriankohws

Actually first look from your problem remembers mine when I started using Crystal Report, that's why I keep asking you to check the data whether all are numerics.
rgn2121

No points needed for me...I didn't do anything.  Split between the other experts...glad you got it working!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
JerryFromSD

ASKER
Reply, I will take Adriankohws advice and split the points between him and mimcc - Thanks to all
Alpesh Patel

Please create sum of field on that field and select Reset on group value change.
Mike McCracken

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JerryFromSD

ASKER
I accept mimcc's solution