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: 
Not applicable

Time Calculations

Hi All

I need to find out how I can multiply a number of hours by expected personnel, to get total hours booked to event.  the calculation to get the Hours are

if(interval(EndTime - StartTime,'hh:mm')<0, interval(Date(EndTime,'ddmmyy')+1 - StartTime,'hh:mm'),interval(EndTime - StartTime,'hh:mm') )as [Total_Hours] and the personnel Expected is a sum of numbers.  so the total booked hours should be 21:00, but I cant workout how I can calculate a time calculation by a number calculation. am i missing something

can anyone help.

Capture.JPG.jpg

thanks in advance

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Oh sorry.

Pfa the updated one

View solution in original post

15 Replies
tresesco
MVP
MVP

Could you post your sample qvw?

hic
Former Employee
Former Employee

First, you have too many formatting functions in your expression. Remove them: They do not change the calculations; they just prevent you from seeing the structure of your expression. Instead of

     If(  interval(EndTime - StartTime,'hh:mm')<0,

          interval(Date(EndTime,'ddmmyy')+1 - StartTime,'hh:mm'),

          interval(EndTime - StartTime,'hh:mm')

          ) as [Total_Hours]

you should write

     Interval(

          If(  EndTime - StartTime <0,

               EndTime +1 - StartTime,

               EndTime - StartTime ),

          'hh:mm' ) as [Total_Hours]

If you want to format it, you should put the formatting function as the outermost function.

Secondly, if EndTime and StartTime are correctly interpreted, they have numeric values where a difference of one day is 1, and a difference of one hour is 1/24. This means that you can get the number of hours through

     (EndTime - StartTime) * 24

HIC

Not applicable
Author

Hi tresesco

I have attached an example now.

thanks

tresesco
MVP
MVP

user id, password?

senpradip007
Specialist III
Specialist III

Can you share the credentials to login to your application?

Anonymous
Not applicable
Author

I was trying open your sample document but it was asking the user ID

try with below

Expected hours = Personel expected*(Totalhours*24)

In total hours you can use your actual expression

Not applicable
Author

Hi sorry about that i forgot it had section access. i have remove this now and re-uploaded

thanks in advance

Anonymous
Not applicable
Author

I tried and it worked

DDT_Hours*24)*[Personnel Expected]

Not applicable
Author

Hi Jebamalai

thanks for taking a look,i need the output to be formated to hh:mm.  can you help?

regards

James