Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quintile Calculation

Status
Not open for further replies.

cromano

IS-IT--Management
May 27, 2011
1
US
I am needing to calculate a series of numbers for a quintile analysis. I have a report that contains a duration field in minutes. The report is sorted on this duration field from low to high. I need to divide these records into the 5 quintiles (for example purposes, let's say I have 50 records, these records would be divided into groups of 10). Within those groups I need to derive the highest value so that I can report that all tasks in the first quintile took less than "x" minutes. I then need to do the same for the second, third, fourth and fifth quintiles. Is there a way to have Crystal Reports perform this analysis?
 
Create a command like this:

select table.duration,
(
select count(table.recordno)
from table
) as totrec
from table
order by table.duration asc

Then in the main report, add duration to the detail section and insert a group on this formula {@grp}:

whilereadingrecords;
numbervar cnt := cnt + 1;
numbervar j;
if remainder(cnt,truncate({Command.totrec},5))= 1 then
j := j + 1;
j

Then you can insert a maximum on duration at the group level.

-LB
 
whilereadingrecords;
numbervar cnt := cnt + 1;
numbervar j;
if remainder(cnt,truncate({Command.totrec}/5))= 1 then
j := j + 1;
j

Sorry, it should have been the above formula /5, not ,5.

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top