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

round off

Hi all,

I am still facing the issue with the format.

I have written this in script

num(floor( duration)/3600,'##.##') as  mytime,

duration in seconds. 

but I need  to show with two decimal

am getting output like below    I need  1274.62  like that

   

1274.621667
1012.946389
30 Replies
soniasweety
Master
Master
Author

Hi sunny,

for your all exp same result check the screen shot

in qlik filterpane

sl.PNG

this after export.sla.PNG

soniasweety
Master
Master
Author

the screen shot which shows hours is correct  but when I write your expression it is not showing the same result.

Colin-Albert

Num is a formatting command it changes the displayed format, but does not alter the actual value.

So your export has the actual data value not the display value.

You need to use round() to change the actual value 

round( duration/3600, 0.01)  as new

soniasweety
Master
Master
Author

is it correct way or not?Colin Albert

Sunny Talwar

my original exp:

interval(round(interval#(if(ETime>=Urgent and ETime<=Critical,ETime-Urgent,Null()), 'ss'), 1/24), 'hh')

I changed to below bcz I have same issue for this also, I didn't test because I don't have data to see output  can anyone give help out of it

=round(if(ETime>=Urgent and ETime<Critical,ETime-Urgent,Null()),0.01)

sunny_talwar

1 Hour = 1/24 = 0.416666, are you looking to show this as 0.42? If that is what you are after, then what you have looks good....

soniasweety
Master
Master
Author

sunny,

this exp calculation is

if(ETime>=Urgent and ETime<Critical,ETime-Urgent,Null())

etime>= 36000sec    and etime<critical   is 56000sec

so this result I want to show in hours with two decimals.

rubenmarin

Hi sony, maybe with:

Round(DurationInDays*24, 0.01)

or:

Round(DurationInSeconds/86400*24, 0.01)

If you use interval you can see 86400 but that's only the text representation, internally it stores the numeric value '1' (86400 seconds = 1 day), so 86400 (interval-seconds) + 1 = 2, and also 24 (interval-hours) + 1 = 2.

To do this operations maybe it's better to do the maths, multiplying the days by 86400 to get the seconds.

What are ETime, Urgent and Critical? are all values? or dates?

soniasweety
Master
Master
Author

What are ETime, Urgent and Critical? are all values? or dates?

above all values in seconds only.

Akina0929
Creator
Creator

Capture22.PNG

rubenmarin

and have you tried the expression?:

Round(DurationInSeconds/86400*24, 0.01)