Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Conditional Count on Average Post Reply Post New Topic
Author Message
Chris Kenny
Newbie
Newbie
Avatar

Joined: 17 Jun 2011
Location: United Kingdom
Online Status: Offline
Posts: 1
Quote Chris Kenny Replybullet Topic: Conditional Count on Average
     Posted: 17 Jun 2011 at 4:02am
Hello

I have been wasting my entire day trying to find out how to do this and hope someone can help me!

I have the following table (I think it is very badly designed which is part of hte problem)

Survey ID is the number of the survey and is a fixed reference.
Question Ref is the number of the question on the survey, each survey has 12 questions, though I am excluding 4 from the report using the Select Expert.
Question score is the score for the question out of five.

Survey ID | Question Ref | Question Score
A | 1a | 4
A | 1b | 3
A | 1c | 3
A | 2a | 5
A | 2b | 4
A | 3a | 2
b | 1a | 4
b | 1b | 5
b | 1c | 5
b | 2a | 5
b | 2b | 4
b | 3a | 2
c | 1a | 4
c | 1b | 3
c | 1c | 3
c | 2a | 2
c | 2b | 4
c | 3a | 2

I am trying to get to:

* an average score for each survey eg.

A | 3.5
B | 4.2
C | 3

* I then want to be able to have a total number of the number of surveys where the average score is > 4. ie 1.

I've managed to get the details in the form of a cross-tab table, but cannot get it to count the number of >4.

Any help will be very gratefully received! I have had a good search on here and elsewhere on the internet but have not been able to locate an easy to understand solution.
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 20 Jun 2011 at 7:10am
if you are using crosstab then try creating a formula like
"average score":
if {Survey ID} = "A" then 3.5 else
if {Survey ID} = "B" then 4.2 else
if {Survey ID} = "C" then 3
and another formula like
"Count"
if {"average score"} > 4 then 1

Use {"Count"} in you summery field

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