Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula for Counting the # of occurrences of a tx Post Reply Post New Topic
Author Message
myblacsktar
Newbie
Newbie


Joined: 17 Nov 2009
Online Status: Offline
Posts: 1
Quote myblacsktar Replybullet Topic: Formula for Counting the # of occurrences of a tx
     Posted: 17 Nov 2009 at 8:59am
Hello Guys,
 
I am Using Crystal Report 11 Prof.
 
The DB is MS ACCESS
 
Here is what i trying to do:
 
I have a Table in my DB Name "Risk"
The Column Name "Status"
The Column Data Can Only have three data type: "Open", "Proposed" & "Closed"
 
On The Column "Status": I have 8 "Open" and 1 "Proposed". 
So a Total of 9.
 
I need a formula that will:
 
Count the number of occurrences of a text string (i.e "Open") in a column:
 
On This Column "Status": I have 8 "Open" and 1 "Proposed". 
 
This is what i think the formula should look like:
 
Sum ({Risk.Status})-LEN(SUBSTITUTE('Status',"Open",""))/LEN("Open")
 
This formula is not working is telling me that i need more ")".  I can do it on excel but i am trying to create the formula in the "Formula Field" and Called It "Counting Open Risk"
 
This is the Formula that i used to count the number of Risk in the Project:
 
DistinctCount ({Risk.ID}) [This returns 9] *Which is correct....
 
Well, I hope someone here can help me with this small issue i am having...
 
thank you for help in advance.
 
JoseR
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Nov 2009 at 9:36am
Create a Running Total (RT) as:
Name="Count Open Risk"
Field to SUmmarize={Risk.ID}
Type od Sumamry=DistinctCount
Evaluate as Use a Formula....insert the formula....{Risk.Status}="Open"
reset=Never
the RT must be placed on a report footer to show the total.
 
Or if you have no dupe records that you have to worry about make a formula field and SUM thais formula field:
fromula called OpenCount: if {Risk.Status}="Open" then 1 else 0
 
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