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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate percentage for values in one groups for Crystal IX

Status
Not open for further replies.

lana123

Programmer
Aug 20, 2003
79
US
Hello, people!
The data is group by month in my report. I show the data for two years. So the claim count in the report is shown this way:Jan 06 25
Feb 06 45
Mar 06 32
...........
Jan 07 27
Feb 07 41
...........
I have to calculate the percentage of change in Count from Prior month;
and percentage of Change in Count from Jan 06;
(My problem is that I have to show the changes of the field to the previous value of the same field in one group in Crystal repot
For example for Feb 06 the calculations should be:
(45 - 25)/25*100

Please, advise...
I'll appreciate any answer.
Thanks in advance,

Lana
 
I'm assuming you want to compare all months with Jan 06 and also each month with the previous month. Create this formula and place it in the group section based on month:

//{@%changefromprevmo}:
whileprintingrecords;
numbervar prevmo;
numbervar currmo;

prevmo := currmo;
currmo := count({table.claim},{table.date},"monthly");
if prevmo <> 0 then
(currmo-prevmo)%prevmo;

//{@changesfromjan06} to also be placed in the group section:
evaluateafter({@%changefromprevmo});
whileprintingrecords;
numbervar currmo;
numbervar jan06;

if month({table.date}) = 1 and
year({table.date}) = 2006 then
jan06 := count({table.claim},{table.date},"monthly");
if jan06 <> 0 then
(currmo-jan06)%jan06

Then select each formula result and click on the % icon in the toolbar.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top