Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pascaldijkshoor
Creator
Creator

Summing up times

Hello,

I want to create some formulas with two calculated fields. Both calculated fields (EXTRA_TIME_1 and EXTRA_TIME_2) are in the format 'hh:ss:mm'. I noticed something went wrong when I wanted to create some formulas with those calculated fields. I have made a simple table to show you the problem. When I display both fields as a dimension in the table, the field shows the correct value. But when I add a simple measure (EXTRA_TIME_1 + EXTRA_TIME_2), the value is not correct.  What is going wrong?

$3D8072B1045B512D.jpg

Thanks in advance.

1 Solution

Accepted Solutions
Anonymous
Not applicable

From a quick eyeball it seems as if the discrepancies are all by a factor of 24 hours adrift, maybe look at the underlying numeric vales of your EXTRA_TIME_1 & EXTRA_TIME_2 fields bearing in mind the underlying interval numbers are such that :


     1          is 1 day as in 24 hours

     0.5       is half a day as in 12 hours

     1.5       is a day and a half is 36 hours

A frig might be to only use the frac() values in your calculation, but I suggest caution frigging it like that before understanding the underlying root cause.

frac(EXTRA_TIME_1) + frac(EXTRA_TIME_2)

View solution in original post

6 Replies
kakani87
Specialist
Specialist

Did you Check in number format as Duration

timeformat.png

pascaldijkshoor
Creator
Creator
Author

Yes the number format is in duration

kaanerisen
Creator III
Creator III

I am not sure how to extract "hh:mm:ss" but you can use time function after summing up times.

Time(Timestamp('01.01.2018 09:00:00','hh:mm:ss')+Timestamp('03.01.2018 11:00:00','hh:mm:ss'))

Untitled.png

pascaldijkshoor
Creator
Creator
Author

When i do this the same problem occures

Anonymous
Not applicable

From a quick eyeball it seems as if the discrepancies are all by a factor of 24 hours adrift, maybe look at the underlying numeric vales of your EXTRA_TIME_1 & EXTRA_TIME_2 fields bearing in mind the underlying interval numbers are such that :


     1          is 1 day as in 24 hours

     0.5       is half a day as in 12 hours

     1.5       is a day and a half is 36 hours

A frig might be to only use the frac() values in your calculation, but I suggest caution frigging it like that before understanding the underlying root cause.

frac(EXTRA_TIME_1) + frac(EXTRA_TIME_2)

pascaldijkshoor
Creator
Creator
Author

Thanks! This solved the problem