Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

pascaldijkshoor
Contributor

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

Re: Summing up times

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)

6 Replies
kakani87
Contributor III

Re: Summing up times

Did you Check in number format as Duration

timeformat.png

pascaldijkshoor
Contributor

Re: Summing up times

Yes the number format is in duration

kaanerisen
Contributor III

Re: Summing up times

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
Contributor

Re: Summing up times

When i do this the same problem occures

Re: Summing up times

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
Contributor

Re: Summing up times

Thanks! This solved the problem

Community Browser