Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Calculating Hours Worked

Hi Everyone,

I have a small problem. I am trying to calculate hours worked. I have a table which stores how much time was spent working on a job. I need to add up the time and show how many hours were spent working on the job. When I add-up a group of times the answer is 7.75 and should be 8.3. It's stored in the database as 5 position 2 decimals. Not as timestamp. Thanks in advance.

Thom

7 Replies
erichshiino
Partner - Master
Partner - Master

Can you send us a data sample and the expressions you are using?

Rgds,

Erich

tmumaw
Specialist II
Specialist II
Author

Contract

Contrac Line

Status

Date

Integer

Expression Default

Fixed to 1

8

7.75

7.8

43188674

90

C

3-Jan-11

0

0.25

0.3

43188674

90

C

6-Jan-11

0

0.25

0.3

43188674

90

C

10-Jan-11

0

0.25

0.3

43188674

90

C

13-Jan-11

0

0.25

0.3

43188674

90

C

17-Jan-11

0

0.25

0.3

43188674

90

C

20-Jan-11

0

0.25

0.3

43188674

90

C

24-Jan-11

0

0.25

0.3

43188674

90

C

27-Jan-11

0

0.25

0.3

43188674

90

C

31-Jan-11

0

0.25

0.3

43188674

90

C

3-Feb-11

1

0.5

0.5

43188674

90

C

7-Feb-11

0

0.25

0.3

43188674

90

C

10-Feb-11

1

0.5

0.5

43188674

90

C

14-Feb-11

0

0.25

0.3

43188674

90

C

17-Feb-11

1

0.5

0.5

43188674

90

C

24-Feb-11

1

0.5

0.5

43188674

90

C

3-Mar-11

1

0.5

0.5

43188674

90

C

10-Mar-11

1

0.5

0.5

43188674

90

C

17-Mar-11

1

0.5

0.5

43188674

90

C

24-Mar-11

1

0.5

0.5

43188674

90

C

31-Mar-11

1

0.5

0.5

43188674

90

C

7-Apr-11

1

0.5

0.5

Sum(Hours) with different numeric layouts

Anonymous
Not applicable

Hi Thom,

If I got it correctly - 7.75 in your data means 7h 45mins. Is that correct?

I think breaking the numbers in two parts (xx.yy) and using the formula sum(xx + yy*3/5) should translate this in proper hours.

Try this one:

sum ( floor (Expression Default) + frac(Expression Default)*3/5 )

and let me know if it works, please;

---------------------------------------------------------------------------------------------------------

Dilyana Ivanova
Consultant, CapricornVentis
QlikView Elite Partner
tmumaw
Specialist II
Specialist II
Author

Dilyana,

My 7.75 should be 8 hrs. and 15 mins. or 8.25.

Thanks

Thom

erichshiino
Partner - Master
Partner - Master

I'm sorry, I meant the raw data as well. I'd like to see this part:

' It's stored in the database as 5 position 2 decimals.'

Not applicable

hi boss,

cau tou try this once



interval(time#([Hours Worked],'hh:mm:ss'),'hh:mm') as Worked_Hours

thanks,

Not applicable

hi boss,

cau tou try this once



interval(time#([Hours Worked],'hh:mm:ss'),'hh:mm') as Worked_Hours

thanks,