Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Cross tab averages Post Reply Post New Topic
Author Message
Apoc21
Newbie
Newbie
Avatar

Joined: 03 Feb 2010
Location: South Africa
Online Status: Offline
Posts: 3
Quote Apoc21 Replybullet Topic: Cross tab averages
    Posted: 03 Feb 2010 at 11:00am
Hi Guys.

I have a report in Crystal 2008

Im using a cross tab to display students with there marks.

on the end i have a SUM of all the marks and a average.

but where the trick comes in the mark is returned from the stored procedure as a string, because if a student did not write an exam it must display 'xx' instead of a '0' or '45' or whatever the mark may be.

so i created a formula field with the folowing code:

///////////////////////////////////////////////////////////
Local NumberVar MarkInt;

If NumericText({sp_Register_Reports;1.Mark}) Then
ToNumber({sp_Register_Reports;1.Mark});

///////////////////////////////////////////////////////////

And for the SUM it works great.

but now on the AVG it doesnt work correctly.

example there is supposed to print 21 guys on a list.
and their marks sum up to be 627, but 2 of those students did not write exam it throws the average out.

now : 627 / 21 = 30
should be : 627 / 19 = 33

How can i tell the avg to only COUNT the students that has a mark and not an 'xx' to use for the avg?

Please Help

IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 03 Feb 2010 at 12:50pm
You would need to create your own counter (running total?) and have the formula 'NumericText({sp_Register_Reports;1.Mark})' for the Evaluate condition.
 
That should give you a true count.
IP IP Logged
Apoc21
Newbie
Newbie
Avatar

Joined: 03 Feb 2010
Location: South Africa
Online Status: Offline
Posts: 3
Quote Apoc21 Replybullet Posted: 03 Feb 2010 at 9:46pm
Originally posted by kevlray

You would need to create your own counter (running total?) and have the formula 'NumericText({sp_Register_Reports;1.Mark})' for the Evaluate condition.
 
That should give you a true count.


Thanks but how do I tell the average on the cross tab to take that running total field in to the calculation?
IP IP Logged
Apoc21
Newbie
Newbie
Avatar

Joined: 03 Feb 2010
Location: South Africa
Online Status: Offline
Posts: 3
Quote Apoc21 Replybullet Posted: 08 Feb 2010 at 9:49pm
bump
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 09 Feb 2010 at 12:27pm
I wish I had a answer,  I am having issues with using a crosstab myself. 
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.