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

Adding a Decimal to a Duration

Hello All,

I need to add two time values together, but they are in different formats. The first is in h:mm:ss format, and the second is a decimal:

Working HoursOvertime
1:00:001.08
2:23:00

2.20

In other words, I need to add 1:00:00 (1 hour) to 1.08 hours. My desired output is 2:04:80.

I have tried changing the format to duration and the pattern to h:mm:ss, but Qlik is recognizing the 1.08 as 1.08 days (25:55:12), not 1.08 hours.

I appreciate the help. Let me know if you need more information.

Aaron

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try something like

SET TimeFormat = 'h:mm:ss';

LOAD *,

          Interval(Rangesum( [Working Hours], OvertimeQV) ) as SummedTimes;

LOAD [Working Hours],

           Overtime,

          Overtime / 24 as OvertimeQV

FROM ...;

View solution in original post

1 Reply
swuehl
MVP
MVP

Try something like

SET TimeFormat = 'h:mm:ss';

LOAD *,

          Interval(Rangesum( [Working Hours], OvertimeQV) ) as SummedTimes;

LOAD [Working Hours],

           Overtime,

          Overtime / 24 as OvertimeQV

FROM ...;