Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula for counting dates Post Reply Post New Topic
Author Message
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Topic: Formula for counting dates
     Posted: 04 Apr 2012 at 7:38am
Hello
 
I need a formula where i need to count amount of discharges
 
im guessing i have to create a formula where i say if there is a discharge date then count 1. Once i have that formula i will do a sum on the formula to get the number i need?
 
what should my formula look like?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Apr 2012 at 7:52am

unless you have duplicate values you can just do a count on the date field. it will exclude NULLs from the count.

Count(table.dischargedate)
 
If you have duplicate rows then you will need to do variable formulas, or a running total (RT).
I prefer Running Totals (many other prefer variable formulas).
The RT version is
Right click on Running Totals and select NEW
Name = DischargeCount (or whatever)
field to summarize= PK from the episode table where the discharge date is
type of summary=DistinctCount
evaluate=use a formula
NOT(isnull(table.dischargedate))
reset=Never (for a grand total)
place in report footer (RTs do not work in headers)
 


Edited by DBlank - 04 Apr 2012 at 7:53am
IP IP Logged
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Posted: 04 Apr 2012 at 8:18am

you are awesome!

thank you for the prompt reply Thumbs%20Up
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