Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Subtraction formula Post Reply Post New Topic
<< Prev Page  of 2
Author Message
clumbsy
Newbie
Newbie
Avatar

Joined: 24 Sep 2009
Location: United States
Online Status: Offline
Posts: 16
Quote clumbsy Replybullet Posted: 28 Sep 2009 at 6:05am
This is my formula in my group header (which is group by account)
global numberVar nUsage :=0;
 
this is my formula in my details section
global numberVar nUsage :={BI_INTERVAL_RDGS.BI_RDG}-(if nextisnull({BI_INTERVAL_RDGS.BI_RDG})then{BI_INTERVAL_RDGS.BI_RDG}
else next ({BI_INTERVAL_RDGS.BI_RDG}));
nUsage;
Problem is my group is not setting back to zero it is subtracting the RDGS from the next record.
 
example:
Account          Date           RDG           Usage
1001           9-24-2009    59927            9
                   9-23-2009    59918           10
                   9-22-2009    59908           8
                   9-21-2009    59900          54555 this is where it subtracts RDG
                                                                       from next record
1002          9-24-2009     5345             1  It took my 59900-5345=54555
but odd thing is it shows like this for each account on my report but on the drill down of a particular account number it shows it reset to zero. I need to use the report and not the drill downs.
Can you help?
 
 
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 28 Sep 2009 at 8:30am
So the Usage for 9-21-2009 should be 0?
 
Because it's the end of the group, there is still a next record, so it is using that number of the next record. Try something like:
 
    global numberVar nUsage :={BI_INTERVAL_RDGS.BI_RDG}-(if nextisnull
    ({BI_INTERVAL_RDGS.BI_RDG}) or next({Account})<>{Account} then
    {BI_INTERVAL_RDGS.BI_RDG}
    else next ({BI_INTERVAL_RDGS.BI_RDG}));
 
This will give you an amount of 0 for the lowest date for an account number.
 
Hope this helps.


Edited by FrnhtGLI - 28 Sep 2009 at 8:31am
IP IP Logged
clumbsy
Newbie
Newbie
Avatar

Joined: 24 Sep 2009
Location: United States
Online Status: Offline
Posts: 16
Quote clumbsy Replybullet Posted: 28 Sep 2009 at 9:18am
That works.
Thanks so much.
 
IP IP Logged
<< Prev Page  of 2
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.