Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to round hour value

Round up HH:MM to HH

I am using the following expression in text object

= interval(avg({<A={'a'},Month={'Jul'},AvgAttended={'A'}>}HOUR),'hh:mm')


My requirement is round up hh:mm to hh like below:

If mm>=30 , hh value should be incremented by 1

if mm<30, hh value should be as it is


For  example:

AvgResult
56:3757
25:1525

Thanks in Advance....

1 Solution

Accepted Solutions
maxgro
MVP
MVP

maybe using round to hour

=interval(round(interval#('56:37', 'hh:mm'), 1/24), 'hh')

=interval(round(interval#('25:15', 'hh:mm'), 1/24), 'hh')

View solution in original post

6 Replies
PrashantSangle


Hi,

use Time(),Second() or minute() or Hour() to achieve desired result.

In your case 56 is hr or min

Your solution is something like this,

if(Second(Time(time#('25:15','mm:ss'),'mm:ss'))>30,Minute(Time(time#('25:15','mm:ss'),'mm:ss'))+1,Minute(Time(time#('25:15','mm:ss'),'mm:ss')))

if(Second(Time(time#('56:37','mm:ss'),'mm:ss'))>30,Minute(Time(time#('56:37','mm:ss'),'mm:ss'))+1,Minute(Time(time#('56:37','mm:ss'),'mm:ss')))

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
maxgro
MVP
MVP

maybe using round to hour

=interval(round(interval#('56:37', 'hh:mm'), 1/24), 'hh')

=interval(round(interval#('25:15', 'hh:mm'), 1/24), 'hh')

MK_QSL
MVP
MVP

IF(LEFT(Interval(Time(Avg({<A={'a'},Month={'Jul'},AvgAttended={'A'}>}HOUR)),'hh:mm'),2)>=30,

  LEFT(Interval(Time(Avg({<A={'a'},Month={'Jul'},AvgAttended={'A'}>}HOUR)),'hh'),2)+1,

  Interval(Time(Avg({<A={'a'},Month={'Jul'},AvgAttended={'A'}>}HOUR)),'hh'))

MarcoWedel

= interval(round(avg({<A={'a'},Month={'Jul'},AvgAttended={'A'}>}HOUR),1/24),'hh')

Not applicable
Author

Thanks for all your Reply...

Now I got the result.

MarcoWedel

= round(avg({<A={'a'},Month={'Jul'},AvgAttended={'A'}>}HOUR)*24)