5 Replies Latest reply: Jul 19, 2014 6:44 AM by Bill Markham

# round up time data

Hi All,

I want to round up time in qlikivew . For that I am having below data:

EX:  Original Data     Output

22.40                23

23.46               24

23.57               24

It means if after decimal data is > 30 then it should be round up

• ###### Re: round up time data

OriginalValue,

IF(Num(SubField(OriginalValue,'.',2),0.01)>30,

Num(SubField(OriginalValue,'.',1))+1,

Num(SubField(OriginalValue,'.',1))) as NewValue

Inline

[

OriginalValue

22.40

23.46

23.57

24.20

24.10

];

• ###### Re: round up time data

Hi Manish Kachhia,

No actually I want to handle it expression side. I have already written some expression then I will get

22.40, 23.46  ,23.57    n then after that I want to convert it in time i.e, 23,24,24

• ###### Re: round up time data

=hour(ceil(time#('22:40','hh:mm'),1/24))

• ###### Re: round up time data

Bill,

=hour(ceil(time#('22:40','hh:mm'),1/24)) - this is giving me correct ans as 23.

but i have another time as 0:27, so applying above logic, I am getting ans as 1, where I should get 0.

• ###### Re: round up time data

Ooops!!!

Should have used round() and not ceil(), try this :

=hour(round(time#('0:27','hh:mm'),1/24))