Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate Interval Hours

Hi everyone,

I have a question regarding the time interval calculation in QlikView. I am using the following expression:

"Interval (sum ([hours worked]) - sum ([Total Business Hours]), 'hh: mm')" whose purpose is to calculate the balance of hours (bank of hours) of my company. However, if the balance exceeds 24:00, the value will be incorrect. If I have, for example:

Total Business Hours: 2659:05

Hours worked: 2856:00

My balance of hours would be: 196:55

But in my qvw appears: 2491:05

How can I solve this problem?

Regards,

1 Solution

Accepted Solutions
othniel2014
Contributor III
Contributor III

=Interval(

Interval(Sum([Horas Úteis - Total Horas])*count([Funcionário - Nome]),'HH:mm')

-

Interval(sum([Ponto - Horas Trabalhadas]),'HH:mm')

,'hh:mm')

View solution in original post

13 Replies
vishsaggi
Champion III
Champion III

Your expression looks fine for me. Can you share a sample app to look further if possible ?

othniel2014
Contributor III
Contributor III

Capture_Interval.png

works for me...

attach an application for extra help

Edit: within the pivot table works this otherwise

Time#(

Interval(sum(HoursWorked)-sum(BusinessHours), 'h: mm : ss')

,'h: mm : ss'

)

Not applicable
Author

The image bellow show:

Carga Horária: Interval(Sum([Horas Úteis - Total Horas])*count([Funcionário - Nome]),'HH:mm')

Horas Trabalhadas: Interval(sum([Ponto - Horas Trabalhadas]),'HH:mm')

and

Saldo de Horas: Interval(sum([Ponto - Horas Trabalhadas])-sum([Horas Úteis - Total Horas]), 'hh:mm')

Balance of Hours.PNG

You can see that if subtract "Carga Horária" to "Horas Trabalhadas", the difference is:   196:55. But, shows 2491:05 in "Saldo de Horas".

Not applicable
Author

Fine Othniel Coronado,

But if you put some values and use sum function the problem happens.

Thanks for your help

santiago_respane
Specialist
Specialist

Please share a sample app in order to help you better.

Tried you expression in various scenarios and it worked perfectly, with and without the sum and changing the values order.

Maybe there's something with your field format.

Kind regards,

vishsaggi
Champion III
Champion III

Try this and let me know:

Saldo de Horas: = Interval( [Horas Trabalhadas] - [Carga Horária]), 'hh:mm')

vishsaggi
Champion III
Champion III

Carga Horária: Interval(Sum([Horas Úteis] - [Total Horas])*count([Funcionário] - [Nome]),'HH:mm')

Horas Trabalhadas: Interval(sum([Ponto] - [Horas Trabalhadas]),'HH:mm')

Try to add this to your field names. We do not know how your field names are named.

Not applicable
Author

I realized an important information. If I select just one professional the balance of hours it's right! But if I select more then one or all of professionals the balance of hours the problem happens.

Not applicable
Author

Vish Nagaraju,

The right name of the fields is "Horas Úteis - Total Horas", "Funcionário - Nome", "Ponto - Horas Trabalhadas" so I can't put "[" as you said.

Thanks for your your help.