Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Fomula using running totals question Post Reply Post New Topic
Author Message
mvaughn
Newbie
Newbie
Avatar

Joined: 09 Oct 2007
Location: United States
Online Status: Offline
Posts: 16
Quote mvaughn Replybullet Topic: Fomula using running totals question
    Posted: 07 Jan 2010 at 7:45am

Hello, I have a report that is a recap for grades of steel.  For each grade group one of the fields is a fomula of costs for that grade.  The running totals that make up the formula resest on group/grade change and wrok fine.  I also have a report total for all the grades sold in teh month of the report.  The report total costs are also working fine.  Now for the issue, the user would like to see a field for each grade that shows % of total cost.  Basically what I have done is a formula field that says (@GradeCost/@TotalCost) * 100.  Problem is @TotalCost is being evaulated at the same time as @GradeCost, so for the first Grade/Group on the report it shows that the grade is 100% of total costs. When I do the math myself looking at the cost it should be 2.3 %, hence the issue. I have tried coding my CosPct formula as follows but still get the same thing. Any ideas how to get the TotalCosts to have the report value before the grade group is created?

EvaluateAfter({@TotalCost});
(@GradeCost/@TotalCost) * 100
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 19 Jan 2010 at 7:23am
The possible ways would be: a) create the data of the total in a stored proc or b) use a subreport to calculate the total amount at the start of the group.
 
The problem is as you describe...CR doesn't know the total until it is done reading the group, but by then it is too late to update the values.  You can't use an aggregate as it is a formula/running total.
 
HTH
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.