Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Exlude CustomerID from count Post Reply Post New Topic
Author Message
Valmont
Newbie
Newbie
Avatar

Joined: 29 Jan 2007
Online Status: Offline
Posts: 39
Quote Valmont Replybullet Topic: Exlude CustomerID from count
     Posted: 21 Jun 2009 at 8:53am
Hello reader,

Currently These are my groups from a _single_  table (column left = CustomerID, column right = Status)

Group A contains:
A_Cust_12      1
A_Cust_13      6
A_Cust_14      3
A_Cust_15      1


Group B contains:
B_Cust_75      3
B_Cust_76      5
B_Cust_77      3
B_Cust_78      1


Group Special contains:
A_Cust_12      2


So far the columns from a table.
I grouped them as you can see. I want to know the distinctcount of CustomerID in each group, having state 1.

But...
Look at A_Cust_12. This CustomerID is also to be found within group +Special+. And in group +Special+ it has Status 2. therefore, the A_Cust 12 in group A is not to be counted.
State 1 means "paid". But when the customer is in Group Special with State 2 (and 2 only) then something went wrong with the payment. Anyone in Group A or B can only have the same CustomerID in group Special only. A can not occur within group B for example. So if it's in group "Special" with a certain state, then don't count it.

So the real count of CustomerID's in group A = 3. Number 12 doesn't count.
How do I do this?
 I've worked on this for a full day but I can't get it for the life of me.
Please do mind that more groups can (and will) exist, but there is only one group "Special".
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Jun 2009 at 2:38pm
you could use shared variables.
In the header for the group set the variable to 0, in the footer display it.  In the details, since this is all in one table, then there is entry for group special and you can write a formula to not count it
 
shared numbervar disCount;
if {table.specialstatusfield}<>2 then
 disCount := disCount +1;
""  //hide the running count.
 
You might be able to do this with Running Totals, but that is DBlank's specialty, I would use shared variables.
 
HTH
IP IP Logged
Valmont
Newbie
Newbie
Avatar

Joined: 29 Jan 2007
Online Status: Offline
Posts: 39
Quote Valmont Replybullet Posted: 25 Jun 2009 at 4:31am
Hi Lockwelle.

This doesn't work. Try it the other way round: count all of customers in "status 2" in group SPECIAL,  but were copied from group A .
- Because they have status 2 in group SPECIAL, they have a status 'non-2" in group A.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Jun 2009 at 5:58am
If that works for the data, that's fine with me...it is your report...my hope is to guide you to a solution.
IP IP Logged
Valmont
Newbie
Newbie
Avatar

Joined: 29 Jan 2007
Online Status: Offline
Posts: 39
Quote Valmont Replybullet Posted: 26 Jun 2009 at 5:22am
What are you talking about? :)

Thanks for guiding me to a solution, but your initial thought just doesn't work. It's all I'm saying.
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