Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Hans_K
Contributor II
Contributor II

How round a time to the nearest minute?

I have the following expression: Interval(Sum(uren)/24, 'h:mm:ss')

The value of Sum(uren) = 38,75

The result of my expression = 38:44:59

How do get the following result?: 38:45 (rounded to the nearest minute)

Labels (1)
1 Solution

Accepted Solutions
mikaelsc
Specialist
Specialist

round your result to the nearest minute? 

Interval(round(Sum(uren)/24,1/(24*60)), 'h:mm')

"interval()" is just a formatting function.. 

View solution in original post

10 Replies
ManuelRühl
Partner - Specialist
Partner - Specialist

38,75 should return exactly 38:45.

Maybe this works: Interval( ROUND( Sum(uren) , 0.01 ) /24, 'h:mm:ss')

 

Manuel Rühl
www.mamaconsulting.de
Hans_K
Contributor II
Contributor II
Author

Thanks Mruehl. But the result is stil 38:44:59.

Pierrick
Partner - Contributor III
Partner - Contributor III

Hello @Hans_K

try this : Interval(Sum(uren)/24, 'h:mm')

Or change the format of your measure in the vizualisation for Duration and change 'h:mm:ss'

mikaelsc
Specialist
Specialist

round your result to the nearest minute? 

Interval(round(Sum(uren)/24,1/(24*60)), 'h:mm')

"interval()" is just a formatting function.. 

Hans_K
Contributor II
Contributor II
Author

Thanks Pierrick, but still 38:44.

Enno86
Contributor III
Contributor III

I think you need to use "ceil" as a function, in order to round to next higher minute.

Hans_K
Contributor II
Contributor II
Author

Thanks Mikaelsc!

 

The 3th column result is now 38:45. My next challenge is the total-value, that's still 38:44.

 

Hans_K_0-1706523061820.png

 

Hans_K
Contributor II
Contributor II
Author

Thanks Enno86.

It's not the next higher minute. It's the nearest minute. If it's 38:44:29 it should be 38:44.