Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Negative Running total Post Reply Post New Topic
Author Message
MartinHalford
Newbie
Newbie
Avatar

Joined: 13 Aug 2009
Location: United Kingdom
Online Status: Offline
Posts: 19
Quote MartinHalford Replybullet Topic: Negative Running total
     Posted: 13 Aug 2009 at 2:44am
Not sure even if the subject is an accurate description of what I need to do, but this is my problem. In my database I have a column that has cumulative data in it - for example, 1.8, 3.6, 5.2, 7.1, etc, and I need to create a column in CR with the differences - in this case 1.8, 1.8, 1.6, 1.9, etc. Dead easy to do in a spreadsheet, but I'm stumped in CR ...
 
Any help greatly appreciated. Even if its a 'No that's not possible' answer!


Edited by MartinHalford - 13 Aug 2009 at 4:39am
Thanks!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 Aug 2009 at 6:11am

you can use the next or previous functions to find the difference between 2 records, or you could use a shared variable, but next and previous are probably way easier to implement.

 
HTH
IP IP Logged
MartinHalford
Newbie
Newbie
Avatar

Joined: 13 Aug 2009
Location: United Kingdom
Online Status: Offline
Posts: 19
Quote MartinHalford Replybullet Posted: 13 Aug 2009 at 8:59am
Fabulous!  I've actually found something I like in CR!
 
I used the Formula: {DISP.QTY} - Previous({DISP.QTY})
 
Which is great for all values except the first one in the list. Since there is no previous value for this first one, I simply need to transpose just that first element over into my new formula field. Any ideas on how I might go about that? 
 
I tried an If-Then-Else but it makes no difference. I guess because the first row 'previous' call is failing because the value is just not there and so it gives up at that point.


Edited by MartinHalford - 13 Aug 2009 at 9:58am
Thanks!
IP IP Logged
MartinHalford
Newbie
Newbie
Avatar

Joined: 13 Aug 2009
Location: United Kingdom
Online Status: Offline
Posts: 19
Quote MartinHalford Replybullet Posted: 13 Aug 2009 at 10:08am
It's OK - I found 'OnFirstRecord' - problem solved.
Thanks!
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