Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Conditional Count Post Reply Post New Topic
Author Message
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet Topic: Conditional Count
     Posted: 10 Feb 2012 at 2:49am
Good morning
 
I have a report that is grouped by service..
example:  Im trying to get the count to work properly like below
 
service 2000
---------------
ID            Cnt
999            1
998            1
997            1
996            1
998            2
997            2
 
service 2001
---------------
999            2
998            2
 
I am trying to count how many times that ID shows regardless of the grouping..

Thanks
 
 


Edited by lowester - 10 Feb 2012 at 3:36am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Feb 2012 at 6:38am
if you want it regardless of grouping the formula is like:
count({table.field})
 
while for a specific group it is:
count({table.field}, {group})
IP IP Logged
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet Posted: 10 Feb 2012 at 7:41am
If i put that in the detail.. It only does if for that group..
 
Its grouped by a code..

So for code 1000 id 999 will show up 3 times
 
In code 1001 999 will show twice
 
I want it to be a running count on the client id regarless of the grouping..

Im hoping to see this
 
1000
---------------------
ID      ct
998     1
999     1
999     2
997     1
999     3
 
200
---------------------
ID      ct
999     4
999     5
997     2
 
thanks!
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Feb 2012 at 8:24am
I am guessing that you are adding the value using the sigma button...that will count for the grouping.  what i proposed, though I wasn't as clear as I hoped, was to create a formula with the code.  The formula will follow what it's told to do and will ignore the grouping.  Though it sounds like you want it to count based on a grouping, just not the immediate grouping.
 
If you ignore grouping, the value will be the same for all groups, which tends to be confusing to users.
 
HTH
IP IP Logged
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet Posted: 10 Feb 2012 at 9:29am
I really do appreciate the help..sorry im new to crystal and trying to teach myself as i go..
 
I create a formula:
count({ID})
 
Its in the detail section..
 
this is what it returns
 
1000
---------------------
ID       ct
998     8
999     8
999     8
997     8
999     8
200
---------------------
ID       ct
999     8
999     8
997     8


Edited by lowester - 10 Feb 2012 at 9:29am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Feb 2012 at 10:35am
as I mentioned you would get the same count...
 
but thinking about it, you want the formula in the id footer.  I think that will limit to the id you are looking for.
 
what I think you really want is to put the formula in the Id footer but use the grouping to be the 'service' group...I would think that would get what you want
IP IP Logged
lowester
Newbie
Newbie


Joined: 30 Sep 2011
Online Status: Offline
Posts: 23
Quote lowester Replybullet Posted: 13 Feb 2012 at 3:25am
I guess thats the issue..  Im not grouping by ID so i dont have an ID footer... I was hoping there was a way to do it without grouping by ID 
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