Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Porblems summarizing formula field Post Reply Post New Topic
Author Message
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Topic: Porblems summarizing formula field
     Posted: 21 Dec 2009 at 1:33pm
I have a report that contains two different status ID values. I had to do some totaling based on separate status ID by creating a simple formula of: 

If (table.statusID) = 1
then table.fieldvalue)
else 0

I did this and got an initial subtotal fine.

I also did this another field for statusid - 3 as I had to separate them, but include them both on same report.

Now I am trying to do a summary of that subtotal and I am getting some hugely insane number not even close to the correct values.
I have the report
groping by a team, then date range, and then individual. I created the first subtotal based on date range by individual, and now trying to do a team total by month.

Hopefully that make sense.

Flanman

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 21 Dec 2009 at 2:11pm
Does this relate to your other recetnly posted question about joining 2 tables? Sounds like your rows exploded via the join.
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Posted: 21 Dec 2009 at 4:38pm
No. This is a different report. The values and status ID on this report are actually in the same table. That is why I am at a loss.

Flanman
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Dec 2009 at 7:21am
So you only have one table being used one time in this report?
Double check your database expert to make sure ther eis nothing screwy with this part of it.
 
Look at your details and make sure you do not have any duplicate data rows.
Your Team total by month should look something like
Sum(@formulafield, table.Datefield, "Monthly")
Does it?
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Posted: 23 Dec 2009 at 12:28pm
I am using more than one table, but the field I am trying to summarize is of course all on one table. I checked my formula and looks like:
Sum ({@ProceduresGoal},{DriveMaster.FromDateTime} , "Monthly"). but I am still getting an extremely high number. I also checked my db expert for joins, et and look fine from what I can see.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Dec 2009 at 12:35pm
If you are using 2 tables your join can cause duplicate data rows.
Sort on a field that is easy to see duplication (like a primary key) and look at your detail rows. Do you see any dupe records?
 
Or if all the fields you are using are coming from one table then your join may not be enforced. Go  into the Database expert and enforce the joins


Edited by DBlank - 23 Dec 2009 at 12:36pm
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Posted: 23 Dec 2009 at 1:02pm
What I have figured out is I am doing a summary by monthly of a rep.  I am adding several columns and that is all fine. However, this one field Is a Monthly Goal. The Goal is a static number until I try to summarize it for more than one rep. When I do that summary the Goal is summarizing for each entry and that is why I am getting the large number. I will illustrate below

Employee1
Date                 field1    Field2    Goal
1/2/09                  5            5      
1/5/09                 10          12     
1/9/09                   6           9        
MonthlySub         21          26       100

Employee2
Date                 field1    Field2    Goal
1/2/09                  8           14   
1/5/09                 12          7     
1/9/09                 10          12       
MonthlySub         30          33      150

Team Sub           51          59       750 (here is the issue) total should be 250

In the report I am surpressing the daily details, and only showing the Monthly and then team subtotals. The original goal value is coming from a joined and matches fine for the employee subtotal as I do not have that field in the details section, but when subtotaling for the team it is adding the goal for every day. Hopefully that all makes sense.

Flanman
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Dec 2009 at 1:12pm
Suppressing does not impact totals, sums , averages, etc.
The data still exists and will still be incuded unless you explicitly make it excluded.
By placing the Goal ion your GF2 it only displays the last row of data. However when you go to SUm it it still sums all the rows.
To exclude the extra amounts use a Running Total (you can also use variable formulas if you want but I use RTs).
The below asumes you have 2 groups
G1=TEam
G2=Employee
If that is incorrect and you are only grouping on employee bump these up one grouping...
Create a RT
Name=TeamGoal
Field to Summarize=Gaol
Summary Type=SUM
Evaluate=On Change of Group (select Group2)
Reset=On change of Group (select group1)
Place on GF1
(RTs have to be palced on details or footers. They do not work on headers)
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Posted: 23 Dec 2009 at 1:39pm
Once Again you are a great help and a genius. I was working on this all week. Thanks so much for the help and have a happy holiday.
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