Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation on Group 1

Status
Not open for further replies.

visit2me

MIS
May 21, 2010
17
0
0
US
Hello All,

I am struggling to figure out a way to calculate couple of the requirement that my business office requested on their new report. A report that has 3 groups Company, Aging Date (for each two weeks), and Customer name. Report looks like below and I need to calculate as below. Customer group is suppressed.

-------------------********AgingAmount$$ *** %%%(needs to do below calculation???)
GH1 -----Company AAA
GF2 ------5/27/2012 *****0.00 ************ 0%
----------6/10/2012 ******20000.00 **********(20000.00-0.00)/0.00
----------7/8/2012 *******40000.00 *********(40000.00-20000.00)/20000.00
----------7/22/2012 ******30000.00 **********(30000.00-40000.00)/40000.00
GH2 ------Comapany BBB ----
------- ----
---- ---

I need to do a %%% calculation base on AgingAmount. I tried shared variable but didn't work. Please suggest your ideas as to how to approach to this problem.

Thanks in Advance,
 
Shared variables are used for picking up data from subreports. Not needed in your case.

Crystal has a fine range of automatic calculations, percentages includes. The use of Crystal's automated totals is outlined at FAQ767-6524. It's worth doing a few test reports to see just what they can do.

PS. It helps to give your Crystal version - 8, 8.5, 9, 10, 11, 2008 or whatever. Methods sometimes change between versions, and higher versions have extra options. In this case, it probably makes no difference.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Assuming you have used the standard date grouping function for a date, ie third window when you group by date includes option for Every 2 weeks

In company Groupheader

@reset
whileprintingrecords;

global numbervar Current:=0;
global numbervar Prior:=0;


In the 2 weekly group footer add this formula

@% Calc

whileprintingrecords;

global numbervar Current;
global numbervar Prior;

Prior:= Current;

Current:= Sum({agingamount}, {datefield used for grouping}, "biweekly"):

If Prior = 0 then 0 else
current % prior;


Ian
 
Thanks Madawc for your input on my issue.
Also, thanks to IanWaterman for your input as well. I kinda have similar formulas set up in my report.

@Current is a formula to calculate amount due.

@Current%%

shared numbervar firstbiweek;
shared numbervar secondbiweek := sum({@Current},{rptALL_AR_AgingAsOf_Trend;1.Aging Date}, "biweekly");
shared numbervar CurrentPct;

if firstbiweek = 0 then 0 else
CurrentPct := (secondbiweek - firstbiweek)/firstbiweek*100;
firstbiweek := secondbiweek;
CurrentPct;

When I put @Current%% formula on detail section I get first record with correct calculation and rest of calculation is 0. And when I put same @Current%% formula field on GroupFooter 2 then i get 0 or wrong number. I got answer on my detail section on first row only. How do I get that detail section first row result on GF2.

Thanks,
 
Thanks to IanWaterman. I finally figured it all out. I was using wrong field for my @Current Aging Amount Due. With correction, your suggestion and formula worked fine.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top