Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct Count on user defined formula value

Status
Not open for further replies.

mynameant

Programmer
Oct 19, 2005
64
US
Hi all, I am using CR10 version and has created a formula in my report details section.
data in my report is like this:

indtotyes & indtotno are the formulae i have created to total each "ind" [if ind is yes then indtotyes is 1 else indtotno is 1]
Code:
                                   --Suppressed
         empno    empname  proj  ind   indtotyes  indtotno
details:-1234      xxxxx    A    yes     1         0
         1234      xxxxx    B    yes     1         0
         2345      yyyyy    A    no      0         1
         abc       12345    A    yes     1         0
                                  
 Group footer:                          ----       
  total for yes:-                         3
                                        ----
                                                  ----
  total for no:-                                   1
                                                  ----
As you can see, indtotyes is 3 ,but there is a dual count on empno 1234 [who is in two different projects]. How can i count 1234 once and not twice ?

Hope i am clear in explaining my problem. please let me know if it's not.

Thank you all..
 
Your formula shouldn't work anyway, that's not the proper syntax.

And you don't state what you're grouped by.

Please try to post basic technical information, if you reference a group, state what it is...

Try using 2 Running Totals, which ahvea distinct count of the empno, and have the following in the evaluate->use a formula:

ind = "yes"

and in the other use:

not(ind = "yes")

Make sure that you have then reset at the group level.

Then place the Running Totals in the group footer.

-k
 
Synapsevampire:
Thanks for your responses. I am sorry, did not give you full information. I was just looking for creating formula and did not think, that was needed. Anyways, here are the details:
Code:
 Group header:
      Location Name: America
         empno    empname  proj  ind   indtotyes  indtotno
details:-1234      xxxxx    A    yes     1         0
         1234      xxxxx    B    yes     1         0
         2345      yyyyy    A    no      0         1
         abc       12345    A    yes     1         0
                                  
 Group footer:                          ----       
  total for yes:-                         3
                                        ----
                                                  ----
  total for no:-                                   1
                                                  ----
Actual values in "ind" column are 1 or 0. For report, i was changing the display string to "yes" if 1 "no" if 0.
So in my formual if "ind" is 1 then, iam using 1 in "indtotyes" [Suppressed column] and if "ind" is 0 then i am using 1 in "indtotno"[Suppressed column]. so i can summarize them for group and get final totals [running].
Like I mentioned, problem was how to make those count for distinct empno's.

The way I understood your solution was:
Create a distinct empno [running total] at group level.
create two seperate formulas [in detail] one for ind="yes" and other for ind ="no".
then what is the need for distinct empno total?
Also,
I did not understand your comments on
"have the following in the evaluate->use a formula:"

What is evaluate?

I am sorry,I am a little dumb when it comes to Crystal [:)]

And thanks for all your help,
 
SV meant for you not to use formulas, but instead to insert running totals. Go to the field explorer->running total->new. Select the empno field, choose distinctcount, and then choose evaluate using a formula and in the x+2 formula area, enter:

{table.ind} = "yes"

Reset on change of group (Location). Place the running total in the group footer for location.

Create a separate running total for the "No"s, just changing the evaluation formula.

-LB
 
ok. Now I get it. I could successfully implement that and it's working fine. Thanks lbass and SV for all your help.
I think, I should read responses couple of times, before asking followup questions.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top