Print Page | Close Window

Calculating Percentage

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20990
Printed Date: 27 Apr 2024 at 12:24am


Topic: Calculating Percentage
Posted By: aeckaren
Subject: Calculating Percentage
Date Posted: 20 Aug 2014 at 4:49am
I am trying to calculate the % change from one year to the next and it just isn't working. Can someone else look at this and tell me what I'm missing?  My report looks something like this:

Current Assets         Last Year        This Year
   Cash on Hand          $$$$                $$$$


Cash on Hand is in GH3.

I want to calculate the % of change from one year to the next. This is my formula:

((Sum ({@Last Year}, {FLP003.REP5})-Sum ({@This Year}, {FLP003.REP5}))/Sum ({@Last Year}, {FLP003.REP5}))*100

I have checked multiple times and I am selecting the correct group summary (Group #3). Any suggestions? My formula keeps returning the same value for every group. The only other problem that I can see is that maybe the report is confused by the fact that I have the report grouped 3 ways on the same field? Even so, I am certain that I'm selecting Group#3: FLP003.RE05 - A: Sum of @This Year and Group #3: FLP003.RE05 - A: Sum of @Last Year for my calculations.



Replies:
Posted By: kevlray
Date Posted: 20 Aug 2014 at 7:43am
How are you displaying the Last Year and This Year's Cash on Hand.  Is it the {@Last Year} and the {@This Year} formulas? Have you displayed the individual sums (in separate formulas) in your GF and see what you are getting?


Posted By: aeckaren
Date Posted: 20 Aug 2014 at 9:43am
Yes...Last Year and This Year are formulas. One of the formulas:

if {FLP004.PSTPER} = {?Last Year Posting Period} then {FLP004.CYCR04}+{FLP004.CYDR04}

When I look at the % being displayed with the formula above, it's the % calculation for the summary in GF1. This percentage is being displayed on every row of GH3. I'm not sure if I'm explaining that clearly, but here's what it looks like:

Current Assets         Last Year        This Year        % Chg
   Cash on Hand          $$$$                $$$$            -7.11%
   CD                            $$$$                $$$$            -7.11%
   Accounts Rec            $$$$                $$$$            -7.11%

-7.11% is the actual correct % for GF1 (or Total Assets).



Posted By: aeckaren
Date Posted: 20 Aug 2014 at 11:52am
Just a note to let anyone reading know how I solved this problem...

As I said before, I had the report grouped 3 ways on the same field. When I reconfigured the report so that this field {FLP003.REP5} was used in grouping once, everything worked perfectly. I created formulas using {FLP003.REP5} and grouped on the formulas to solve the problem.


Posted By: hilfy
Date Posted: 20 Aug 2014 at 11:53am
Is {FLP003.REP5} the field you're grouping on in Group3? If not, you need to change it to match the field for Group3.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window