Solved

Conditional Running Total

Posted on 2013-05-13
2
291 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now