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

Date / time - functions?

Date / time - how to calculate average time someone is signing into office - in the log we have Sign-In time & sign out time - which date fuctions will do the calculations for average time-in?

Steps are:

Seprate out Sign-IN data from Sign-Out data using colun sign-in/out columns.

Calculate avergae time in

Calculate average hours in office

Calculate % times signed in before 9am etc.

Can anyone suggest how to achive this?

Thanks,

HSD

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Ok, assuming a person is uniquely identified by Emp# and always checks in and out on the same day... you can load the sign in records and sign out records separately and join them on the Emp# + Date combination. And then calculated the time spend.

Or with the datamodel you posted you can use a set analysis expression. Create a straight chart with Emp#. Name and Date as dimensions and as expression Interval(only({<SignInOut={'OUT'}>}Time)-only({<SignInOut={'IN'}>}Time),'hh:mm:ss')

See attached qvw.


talk is cheap, supply exceeds demand

View solution in original post

9 Replies
tresesco
MVP
MVP

It should not be that complex. Calculate the time spent in the office simply like:

Load

          Sign_Out - Sign_In AS SpentTime  // or, use Interval() function

From <>;

Then use AVG() function to get average. Might be you have to work on the time format like 'hh' or 'mm' for hour and minute respectively with some timestamp/time/interval function.

Not applicable
Author

Thanks a ton tresseco - it was very helful to get started on QlikView!!

the problem is Sign-IN time and Sign-Out time are two differnt rows - which I need to match based on date and Employee name - currently assuming for simplycity that the record for Sign-IN time is followed by Sign-Out time -  will it need kind of calculated column - for entire excel & then bring that in QlikView or we can do this across rows calculations in here - within QlikView?

Today is mine just 2nd day of using this tool.

Thanks,

Hemant

Gysbert_Wassenaar

Can you post an example document with some sample data?

Please read these two documents:


talk is cheap, supply exceeds demand
Not applicable
Author

SignInOutDateTimeNameEmp#LocationDomainWeekEndRemoteStatus
IN1/1/20109:01:10Hemant2NYBARCAP1WEEKYAccessGranted
OUT1/2/201017:01:10Shashi10NYBARCAP2WENKENDNAccessDenied
OTHER1/3/201011:01:10John3NYBARCAP3WEEKNAccessDenied
IN1/4/20109:02:10Kaka4NJBARCAP5WENKENDYAccessDenied
OUT1/5/201018:01:10Dan1NYBARCAP4WENKENDNAccessGranted
OTHER1/6/201014:01:10Seetha8NJBARCAP4WEEKYAccessGranted
IN1/7/20109:45:10Shila11TXBARCAP3WEEKNAccessGranted
OUT1/8/201017:31:10Ron7TXBARCAP10WEEKYAccessGranted
OTHER1/9/201017:01:10Reena6TXBARCAP6WENKENDNAccessGranted
IN1/10/201010:01:10Meena5VABARCAP5WEEKNAccessGranted

Here is the sample data - I need to calculate time spent in office by subtracting Time out- TimeIn for same person on same date... assuming no one is staying overnight!!

Thanks,

Hemant.

Gysbert_Wassenaar

Judging from your sample data people either never arrive or never check out. No person has more than one record so there's nothing to calculated from that.


talk is cheap, supply exceeds demand
Not applicable
Author

SignInOutDateTimeNameEmp#LocationDomainWeekEndRemoteStatus
IN1/1/20109:01:10Hemant2NYBARCAP1WEEKNAccessGranted
OUT1/1/201018:01:10Hemant2NYBARCAP1WENKENDNAccessGranted
IN1/11/20107:01:10Dan1VABARCAP9WENKENDNAccessGranted
OUT1/11/201023:01:10Dan1VABARCAP1WENKENDNAccessGranted

Oh. Ok I understand your point!!

Let me correct the data..

Gysbert_Wassenaar

Ok, assuming a person is uniquely identified by Emp# and always checks in and out on the same day... you can load the sign in records and sign out records separately and join them on the Emp# + Date combination. And then calculated the time spend.

Or with the datamodel you posted you can use a set analysis expression. Create a straight chart with Emp#. Name and Date as dimensions and as expression Interval(only({<SignInOut={'OUT'}>}Time)-only({<SignInOut={'IN'}>}Time),'hh:mm:ss')

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Wassenaar!

I will not be able to see the qvw, I will try out what you have said - it should surely work if the data is real-time good data.

Not applicable
Author

I am dealing with test received and test results times and periodically, these will cross calendar days.  I've not been able to create a valid DTS concatonating my dates and times because my date format is not standard.  Unfortunately, the DTS I created is also not workable.

I have reverted back to using just the time stamp, but some results are negative (crossing calendar days)  How do you manage negative numbers when the timestamps are across more than one calendar day?

Thank you!