Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: sum of summarized field in crystal Post Reply Post New Topic
Author Message
new_user12
Newbie
Newbie


Joined: 28 Jun 2009
Online Status: Offline
Posts: 3
Quote new_user12 Replybullet Topic: sum of summarized field in crystal
     Posted: 28 Jun 2009 at 3:08pm
I am new to crystal report and I want to know how to get the sum of min of field in the date level?

here is my example:
date 1
name   qty
a    3
a    10
a    2
minimum (qty) = 2
date 2
a   4
a   6
minimum(qty) = 4
(sum of min qty in each date = 2 + 4 = 6)

I have problem to get the sum at this level?

Thanks,
Xiao
  
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 29 Jun 2009 at 6:48am
You will need to calculate it yourself using shared variables...
standard 3 formulas:
1) in the larges group header(might be the report, in which case this is optional) to reset the variable to 0
2) in the group footer (by date) the incrementor, this is actually easy for once...
shared numbervar sumMin := sumMin + MIN({table.qty},{table.date});
""//hides the calculation
3) in the large group footer, the display...
shared numbervar sumMin
 
HTH
IP IP Logged
Chazlenor
Newbie
Newbie
Avatar

Joined: 29 Jun 2009
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote Chazlenor Replybullet Posted: 29 Jun 2009 at 7:33am
I have a similar problem, which is:

I have passes a shared variable through from a sub report which is a sum per group within the sub report.
On the main report I want to sum this variable at the end of each group and as a grand total at the end of the report.  I have tried using a global variable I found on another forum, but it has a couple of issues:
1. if I place it in the same section as the values from the sub report it does cumulate the figures, but if any of them = 0 from the sub report, it takes the previous value and adds it on instead of staying the same.
2. if I place it in the group footer it just gives the total of the last value from each section.
3. if I place it in the report footer it puts the total from the last entry in the first group.

The method i found on another forum was:

in the sub, in any formula (including formatting formula) add a line like so

@result
shared numbervar TotalCost := <summed val>

in the main report

@GTResultBuild
shared numbervar TotalCost;
global numbervar GTCost;
GTCost := GTCost + TotalCost;

//that lives in the next group footer down from the subreport so it always happens after the sub
 
@GTResultShow
shared numbervar TotalCost;
//this just prints it out

I have been working on this report for several weeks, on and off, and now have everything else I need on the report, apart from these group/report totals; so any help would be greatly appreciated.

regards

David
Message on Spike Milligan's gravestone...
I told you I was ill !!!
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