Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Percent of Change Post Reply Post New Topic
Author Message
goitc
Newbie
Newbie


Joined: 28 Oct 2009
Location: United States
Online Status: Offline
Posts: 6
Quote goitc Replybullet Topic: Percent of Change
     Posted: 28 Oct 2009 at 2:13pm
I need to add a column showing percent of change one day to the next. This report has the last 30 days included in it
Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Oct 2009 at 2:49pm
Likely you will want to use the Previous() function but it is hard to tell.
Please explain the row level data in a bit more detail ... is this the percentage of a totaling field, a field that already is in a percentage format, the percetnage of the difference or something else.
Sample row level data usually helps too.
IP IP Logged
goitc
Newbie
Newbie


Joined: 28 Oct 2009
Location: United States
Online Status: Offline
Posts: 6
Quote goitc Replybullet Posted: 28 Oct 2009 at 8:50pm
Thanks for your reply
This column is a row of values from an Access query. for instance

10.5
12.1
20.3
12.8

one value for each day and I am doing a 30 day report.
I have to show in the next column the percent of change in this value from the previous day. if it helps, each record does have a date field but.
Also, I do not need to keep up with this number in any kind of running total - I just need to populate this next column with the percent of change for this value from the previous day.
i hope this clarifies the situation somewhat and thanks again for your help
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Oct 2009 at 7:07am
Try a formula field using:
({table.valuefield} - previous({table.valuefield})) % previous({table.valuefield})


Edited by DBlank - 29 Oct 2009 at 7:10am
IP IP Logged
goitc
Newbie
Newbie


Joined: 28 Oct 2009
Location: United States
Online Status: Offline
Posts: 6
Quote goitc Replybullet Posted: 29 Oct 2009 at 10:11am
Thanks DBlank
I will try this and let you know.
IP IP Logged
goitc
Newbie
Newbie


Joined: 28 Oct 2009
Location: United States
Online Status: Offline
Posts: 6
Quote goitc Replybullet Posted: 04 Nov 2009 at 10:40pm
Hi
Sorry it took so long to implement this.
DBlank, your suggestion worked perfectly!
Thank you so much
 
Is there a way I can color the text for that cell or preferably that line of the report if the percent is >0 maybe to green and if it is <0 to red? or is that asking too much?
 
Thanks again
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Nov 2009 at 7:05am
You can ink change, field background color change or entire section (line) change.
They all work the same way but yuou place the formula in differnet places to achieve it.
Here is a formula but you can swap the colors out or use custom colors as "color(x,x,x)" or you may need to alter the last else based on what you want 0 to be:
if {@percent_formula} > 0 then crGreen else
if {@percent_formula} < 0 then crRed else crBlack
 
To manipulate only the field ink
Right click on the field and select format field
pick the Font tab
Open the formula box next to the Color option and place your formula there
if {@percent_formula} > 0 then crGreen else
if {@percent_formula} < 0 then crRed else crBlack
 
For the background of just that field
Right click on the field and select format field
pick the Border tab
Open the formula box next to the Background option and place your formula there
if {@percent_formula} > 0 then crGreen else
if {@percent_formula} < 0 then crRed else crNoColor
 
For the background of the entire row
Open the section expert
select the section you want to change (e.g. details)
click on the Color tab (on the right)
Open the formula box next to the Background Color option and place your formula there
if {@percent_formula} > 0 then crGreen else
if {@percent_formula} < 0 then crRed else crNoColor


Edited by DBlank - 05 Nov 2009 at 7:07am
IP IP Logged
goitc
Newbie
Newbie


Joined: 28 Oct 2009
Location: United States
Online Status: Offline
Posts: 6
Quote goitc Replybullet Posted: 05 Nov 2009 at 9:42am
Wow DBlank, that is perfect.
Thank you very much
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