Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Counting Multiple Criteria Post Reply Post New Topic
Author Message
Dbeethekidd
Newbie
Newbie
Avatar

Joined: 12 Oct 2012
Location: United Kingdom
Online Status: Offline
Posts: 7
Quote Dbeethekidd Replybullet Topic: Counting Multiple Criteria
     Posted: 12 Oct 2012 at 12:31pm
Hi All

Another noob with a noob question but any help would be appreciated..

I have 2 groups of buildings called phase 1 and phase 2 which I've identified by grouping them and calling them phase 1 or phase 2 which is displayed in the details next to the respective building name.

Each building has multiple task types that can be raised against it so for example

Building Number - Phase - Task Type
Building 1 - Phase 1 - Cleaning
Building 2 - Phase 1 - Maintenance
Building 3 - Phase 1 - Cleaning
Building 4 - Phase 2 - Catering

What I need to know is how to count if the building is in "Phase 1" and if there are "Cleaning" jobs (or any other Task Types) against it. So for my building list above there would be 2 Cleaning tasks and 1 Maintenance task for Phase 1.

This would need to be individual lines for a summary
For example: Phase 1 - Cleaning - 2, Phase 1 - Maintenance - 1 etc

Once I know this I'll be able to count for the rest of the services within the building

Thanks in advance for any help and if any more information is required please let me know

DB
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 14 Oct 2012 at 12:42am
Hi
 
Create the following formulas to arrive task type count at group 2 level
 
@init  // place this formula in group2 header
Whileprintingrecords;
Numbrevar clean:=0;
Numbervar Main:=0;
 
@Accu // Place this formula in detail section
Whileprintingrecords;
Numbrevar clean;
Numbervar Main;
if {Task_Type} = "Cleaning" Then
clean:=clean+1
else
if {Task_Type} = "Maintenance" Then
Main=Main+1
 
@Disp_clean   // To get cleaning count place this in group 2 footer
Whileprintingrecords;
Numbrevar clean;
 
@Disp_Main // To get Maintenance count place this in group 2 footer
Whileprintingrecords;
Numbrevar Main;
 
If you have any other task types you can include in the above formula(s)
 
 
Thanks,
Sastry
IP IP Logged
Dbeethekidd
Newbie
Newbie
Avatar

Joined: 12 Oct 2012
Location: United Kingdom
Online Status: Offline
Posts: 7
Quote Dbeethekidd Replybullet Posted: 15 Oct 2012 at 4:31am
Hi Sastry

Thanks for the response

Perhaps my explanation was a bit bad as I'm quite new to this..

If my columns were

Buildings - Tasks Types
Building 1 - Cleaning
Building 1 - Cleaning
Building 2 - Cleaning
Building 2 - Maintenance
Building 3 - Cleaning

I need something that's like a SUMIF AND function so it would go

SUMIF {Cleaning} AND {BUILDING 1} OR {BUILDING 2} OR {BUILDING 3}

The answer I would be expecting is 4

I would then do the same for Maintenance and any other etc

Thanks again for any help you can provide

DB

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