Print Page | Close Window

Distinct count of summarized field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17262
Printed Date: 19 Apr 2024 at 10:08pm


Topic: Distinct count of summarized field
Posted By: Robotacha
Subject: Distinct count of summarized field
Date Posted: 10 Aug 2012 at 5:09am
Hello,
 
Could someone please advise on this problem?
 
I have a report, thats grouped by CUSTOMER.
 
in the group header, I have JULY sales, AUG Sales, SEP sales , Total Sales, Level Achieved.
 
mailto:%7b@TotalSales - {@TotalSales };
sum({julysales},customer) + sum({augsales},customer) + sum({Sep Sales},customer)

mailto:%7b@levelachieved - {@levelachieved };
IF mailto:%7b@totalsales%7d%20%3c150 - {@totalsales} <150   THEN "0%"
IF {@totalsales}>= 150 AND mailto:%7b@totalsales%7d%3c299 - {@totalsales}<299 THEN "1%" ELSE
IF {@totalsales}>= 300  THEN "2%"
 
 
 
I want to show the COUNT of customers achieving 0% in the report header.
 
I have wrote another formula;
mailto:%7b@0%achieved - {@0%achieved } and tried;
 
IF {@levelachieved}="0%" THEN {table.customer} ELSE ""
 
 
I was hoping to insert a DISTINCT COUNT on this new formula, but it dont give me the option (I'm assuming its because the mailto:%7b@levelachieved - {@levelachieved } field is already using a summarized formula)
 
 
can anyone suggest a work around? or help?
 
 
Thanks.


-------------
Regards,

Michael Jones



Replies:
Posted By: Robotacha
Date Posted: 11 Aug 2012 at 12:44am
Can anyone help?

-------------
Regards,

Michael Jones


Posted By: Sastry
Date Posted: 13 Aug 2012 at 5:49am
Hi
 
Crystal reports process top to bottom and left to right.  Your count should process first then it should display the value, when it is counting it will process top to bottom and it can't come back and prit the value on reprot header.
 
Work around for this issue is :
 
Insert the same report as sub report on a different report header and write a manual running total like :
 
Whileprintingrecords;  // Insert this formula in your sub report group header//
Shared numbervar x;
 
if mailto:%7b@yourformula - {@yourformula } <150 then
x:=x+1;
 
Write one more formula like :
 
Whileprintingrecords; //  place this in your sub report report footer//
Shared Numbervar x;
 
 
Now in the main report Report create the following formula and place it on Report header ;
 
Whileprintingrecords;
Shared Numbervar x;
 
 
This will get the value into your main report.  You can suppress all sections of your sub report to avoide printing.
 
 
 


-------------
Thanks,
Sastry


Posted By: Robotacha
Date Posted: 14 Aug 2012 at 6:04am
erm..... I dont know what to say, other than OMG! THANKYOU EVER SO MUCH!
 
You dont know how long ive been on this.
I have tried many shared variables, sub reports, allsorts, but to no avail.
 
You have just finalized my report, that will be heavily used in my company.
 
I cannot thank-you enough.
 
It has certainly been a learning curve this one, and I now have the knowledge to implent this solution in other reports.
 
 
Sincere gratitude to you.
 
Anything i can do for you, just shout. anytime.
 
:)
 
Happy Mike.


-------------
Regards,

Michael Jones


Posted By: Sastry
Date Posted: 14 Aug 2012 at 8:21am
Thank You Mike :)
 
 


-------------
Thanks,
Sastry



Print Page | Close Window