Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calculate time in range Post Reply Post New Topic
Author Message
awear01
Newbie
Newbie
Avatar

Joined: 09 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 12
Quote awear01 Replybullet Topic: Calculate time in range
     Posted: 09 Nov 2009 at 9:14am
Hi All,

I'm new to this forum so please bear with me...

I've been trying to work out a way of calculating the number of days that a value has been within a range over many records that are grouped. Here is an example of the main fields:-

ID     VisitDate         Value     RangeLow     RangeHigh    GroupField

 1     01/01/2009        0.9             1                     3               Group1
 2     10/01/2009        1.5             1                     3               Group1
 3     15/01/2009        2.8             1                     3               Group1
 4     20/01/2009        4.0             1                     3               Group1
 5     05/02/2009        2.3             1                     3               Group1
 6     01/01/2009        1.5             1                     3               Group2
 7     10/01/2009        1.5             1                     3               Group2
 8     15/01/2009        3.7             1                     3               Group2
 9     20/01/2009        2.6             1                     3               Group2
10    15/03/2009        2.2             1                     3               Group2


The 'Time in Range' is calculated when 2 consecutive records are in range (in days). I need to be able to summarise the 'Time in Range' for each group as well.

Can anyone help please?????

Thanks
Andy
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Nov 2009 at 6:29am
a formula, look at the next record, and if it is in range increment/display the appropriate value.  Increment would be for the summarization of the value.
 
HTH
IP IP Logged
awear01
Newbie
Newbie
Avatar

Joined: 09 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 12
Quote awear01 Replybullet Posted: 10 Nov 2009 at 6:33am
I have tried the Next function but unfortunatley it won't work when you group the records. The records end up in a different order and the calculation becomes inaccurate.


Andy
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Nov 2009 at 6:55am
then you will need to create a subreport, as that is the only way to read the data that is in the wrong order.
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