Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

5 Replies
MK_QSL
MVP
MVP

Load

  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 

];

Not applicable
Author

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

Anonymous
Not applicable
Author

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

Not applicable
Author

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.

Anonymous
Not applicable
Author

Ooops!!!

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

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