Solved

Conditional Running Total

Posted on 2013-05-13
2
293 Views
Last Modified: 2013-05-14
I have a crystal report where I am trying to do the following:

date              code             points calculated points      accum
04/26/13      TALP        0.5      0.5      0.5
04/29/13      TATD      1      1      1.5
04/30/13      TANN      0      5.5      7
05/01/13      TATD      1      1      8
05/02/13      TANN      0      1      9
05/03/13      TAUF      1      1      10
05/04/13      TALP             0.5      0.5      10.5

If the code is TANN, and the accumulated points are < 7, then the points to use for that TANN code are (7-accum), otherwise the points to use for the TANN code is 1.

It seems like I cannot have a running sum formula refer to itself.

Is there anyway to do this.  See attached example in an Excel file.
calcTANN.xls
0
Comment
Question by:ndornack
2 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39163592
Sure with a manual running total

In the report header add a formula to declare the variables

WhilePrintingRecords;
Global NumberVar TotalPoints;
""

In the detail section add a formula where you want CalcPoints displayed
WhilePrintingRecords;
Global NumberVar TotalPoints;
Local NumberVar CalcPoints;

If {CodeField} = "TANN"  AND TotalPoints< 7 then
     CalcPoints := 7 - TotalPoints
Else If {CodeField} = "TANN" then
     CalcPoints := 1
Else
     CalcPoints := {PointsField};
TotalPoints:= TotalPoints+ CalcPoints;
CalcPoints

To display the new total points
EvaluateAfter({@CalcPoints});
WhilePrintingRecords;
Global NumberVar TotalPoints;
TotalPoints

mlmcc
0
 

Author Closing Comment

by:ndornack
ID: 39166047
Works great!  Thanks.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pictures In Crystal 10 46
Crystal Reports--SubReport 3 55
Crystal Reports Groups need Hand Cursor on Hover 4 77
Mask on Parameter CR2008 28 51
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question