Reputation: 1
Hi I'm new in crystal reporting, i would like to make percentage for annual year growth based current year with the previous year.
For example, I would like to check the growth for CMP4 for current year (2017) and previous year (2016).
CMP_vc_Code,InvYear,Jan,Feb,Mar,Apr,May,June,July,Aug,Sep,Oct,Nov,Dec
CMP1,2016,0,0,318.50,68.25,91,182,338,195.25,140.70,0,117.25,0
CMP2,2017,550.30,0,0,0,0,0,0,0,0,0,0,0
CMP3,2017,160.95,0,0,0,0,0,0,0,0,0,0,0
CMP4,2016,3226.90,13141,13131.40,5108.60,4148,5529.60,1082.25,12945.85,5002.30,2239.80,4035.40,4454.35
CMP4,2017,13362.85,8671.35,10233,0,0,0,0,0,0,0,0,0
I have details of the company sales (row data) which is given to the crystal report. So In crystal report, I first group by data based on year and company. Total of each month is generated dynamic using crystal report sum field. Please help me on this.
Upvotes: 0
Views: 45
Reputation: 65
This should be close to what you are looking for...
1) Make sure your data is grouped be year. (Which it sounds like you are)
2) Insert a SUM summary in the year group footer. (Also sounds good just make sure its in the group footer)
3) Use a formula like this...
Global CurrencyVar b := IF GroupNumber = 1 THEN Sum ({TableName.DollarAmount}, {TableName.Year}) ELSE b; Global CurrencyVar e := Sum ({TableName.DollarAmount}, {TableName.Year}); Local NumberVar p := IF b = e OR b = 0 THEN 0 ELSE ((e - b) / b * 100); // or whatever calculation you are using... b := Sum ({TableName.DollarAmount}, {TableName.Year}); p
4) Place the formula field in the group footer, next to the SUM from step #2.
Upvotes: 0