Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: count needed for a formula with 'maximum' in it Post Reply Post New Topic
Author Message
Pam.1980
Newbie
Newbie


Joined: 06 Aug 2009
Online Status: Offline
Posts: 12
Quote Pam.1980 Replybullet Topic: count needed for a formula with 'maximum' in it
     Posted: 20 May 2011 at 7:19am
I have a formula field to calculate the days between order taken and last time it was sent for closure. There are several dates for closure and only the last one in the table is relevant so the formula is:

1)maximum ({table.field}, table.id}) - {date created}

then I want:
2) total closed in given time range - can be down on report itself
3) count of days < 20 and the percentage of total
4) count of days > 20 and < 50 and the percentage of total

When I try to use the formula with maximum I am unable to do a count. What can I do to calculate #3 and # 4 above.

Thanks much
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 21 May 2011 at 3:14am
use a formula. something like:
shared numbervar l20;
shared numbervar l50;
local numbervar x = your function;
 
if x > 20 and x < 50 then
  l50 := l50 + 1;
if x < 20 then
  l20 := l20 + 1;
 
"" //hides the formula.
 
when you want a count:
shared numbervar l20;
l20
 
if you want % total:
shared numbervar l20;
 
l20 / count({table.field});
 
HTH
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