Solved

Rounding duration within 20 min intervals

Posted on 2016-10-19
3
56 Views
Last Modified: 2016-10-19
I have a value (Duration) in Crystal reports that I want to classify in 0-20 minute intervals. i.e. every 20 mins in a day falls within a specific timeframe and gets assigned a value :-

I'm assuming something like below would need to be compiled.
(if duration <= 20 then 1 else if (duration >20 and duration <=40) then 2).....etc, I would need 71 of these.

      0 - 20mins = 1    
    21 - 40mins = 2
    41 - 60mins = 3
....................................

1401 - 1420 mins = 70
1421 - 1440 mins = 71
 
Below duration values would fall within the above mentioned

13mins         (0-20mins) = (1)
507mins       (500 - 520mins) = (26)
907mins       (900-920mins) = (46)
1358mins    (1340-1360mins) = (68)

Is there an easier way to do this in Crystal ?
0
Comment
Question by:John-S Pretorius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41850394
Hi,

pls try

=Fix((YourDuration-0.1)/20, 0)+1

Open in new window

Regards
1
 

Author Closing Comment

by:John-S Pretorius
ID: 41850419
Perfect Sir, Thank you.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 41850735
In Crystal there is an integer division operator

This will give you 0 to max
{YourDurationField} \ 20

Open in new window


If you want to start at 1 then just add 1
{YourDurationField} \ 20 + 1

Open in new window


mlmcc
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question