Print Page | Close Window

Running Total count

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=15811
Printed Date: 19 May 2024 at 10:26am


Topic: Running Total count
Posted By: ashline
Subject: Running Total count
Date Posted: 06 Mar 2012 at 2:59pm
I am trying to create a running total count.
 
Here is my data
 
ID  Name      Account
1   MC1234   0000
2   MC1235   1233
3   MC1236   0000
 
So I create a running total and tell it to summerize on account
 
For evaluate I create the following formula
 
if account = '0000'
Then True
Else Flase
 
And I leave the reset to Never.
 
Well when I put the total into the report I only get 1.  And with the three records I would expect to get 2.
 
For this report I can not group all the reocrds by accounts and do an insert summary.  This report needs to be grouped differently.

Thanks for any help



Replies:
Posted By: lockwelle
Date Posted: 07 Mar 2012 at 3:14am
I don't know about running totals much...DBlank loves them, and will probably chime in an appropriate solution.
 
I have seen when he wants to counts like this, he will create a formula like:
if account = '0000' then
  1
else
  0
 
then when he wants the count, he will sum up the formula as needed ie
sum( formula, group)  ...   or leave the group off if it is report wide.
 
HTH


Posted By: yggdrasil
Date Posted: 07 Mar 2012 at 3:23am

I would create a Running total called Account0000 (maybe)

then in that set Field to Summarize as Id and Type of Summary as count.

Then I would Evaluate with Use a formula and in that

put {Account} = '0000'

 
I think what you are doing is re-setting your account formula every time, so it is only ever 1. If you had no 0000 it would return 0


Posted By: lockwelle
Date Posted: 07 Mar 2012 at 3:25am
... and I forgot, that if i was doing this, I would just use shared variables, incrementing them as needed and resetting when I deem it correct.
 
forgot that part...
shared variables is basically long hand for running totals


Posted By: DBlank
Date Posted: 07 Mar 2012 at 3:54am

An actual Running Total field (like variable formulas) must be placed on or below the location that has the rows being evaluated (e.g. details or footers).

Your post seems that you built the RT correctly but you did not totally describe it so I am not sure.
Your original post indicates to me that you are placing the RT in the report header. If you do that it only evaluates the first row in the report and will show a 1 (based on your sample data). If you move it tot he report (or group) footer it will evaluate all rows and show you the reult fromt that.
Your evaluation formula does not need an if-then only needs to be
table.account = '0000'
 
Lockwelles description of the formula for converting to a 1 or 0 is a uselful process if you do not have duplicates and you also want to use the insert sumamry function which allows for totals to be used in headers or group selection criteria.



Print Page | Close Window