Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
alvinford
Contributor III
Contributor III

How can I derive Hours from Login and Logout

Hi All,

Also need help on the below.

I have the LoginTime  and LogoutTime need to Generate the Hours between the time in the New Column.

For Example : Taking the highlighted LoginTime and LogOut time i.e. 10:45:23 to 13:14:49 , Need to generate following hours between them i.e. 10,11,12,13 .

LoginTimeLogOutTime
10:09:08 AM10:18:20
10:13:54 AM10:34:26
10:18:46 AM12:19:18
10:22:06 AM11:06:49
10:32:54 AM16:15:54
10:44:11 AM13:12:11
10:45:23 AM13:14:49
10:48:58 AM12:37:48
10:52:21 AM12:39:28
10:58:15 AM11:03:14
10:59:52 AM11:24:11
10:59:57 AM11:49:22

How can I generate new column containing  Hours between the LoginTime and LogOut time ?

Regards,

Alvin.

1 Solution

Accepted Solutions
Not applicable

Hi,

Attached, I send an example.

I hope will be helpful.

Best regards,

Ricardo

View solution in original post

12 Replies
pauljohansson
Creator III
Creator III

Hi,

A tip is to have a look at the IntervalMatch function,

br

Paul

alvinford
Contributor III
Contributor III
Author

Hi Paujoh,

Thanks for your reply. I  have already tried. It will not generate the Hours between the LoginTime and LogOut time.

Regards,

Alvin.

Anonymous
Not applicable

Use interval function, assuming the data format is time:

interval (LogOutTime - LoginTime, 'hh')

Regards,

Michael

alvinford
Contributor III
Contributor III
Author

Hi Michael,

Thanks for your reply.

Interval only gives the difference. But I need to generate the hours between the LoginTime and LogOutTime.

For Example : Taking the highlighted LoginTime and LogOut time i.e. 10:45:23 to 13:14:49 , Need to generate following hours between them i.e. 10,11,12,13 .

Regards,

Alvin.

Not applicable

Hi,

Attached, I send an example.

I hope will be helpful.

Best regards,

Ricardo

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Nice example Ricardo.

-Rob

Not applicable

Hi,

If i my understanding is correct you want to show the hours in a single row not in multiple rows.

I have attached a doc which gives you hours in a single row.

But you have to write the if clause for 24 hrs, which is a bit hectic.

Use if it is ok for you.

Regards,

yaseen

Not applicable

Hi,

Use chaining if clause for this case is not practical.

If you need to put the hours in a line, for my example, you can use the concat() function and gets the hours concatenated. See the script (qvw attached).

Regards,

Ricardo

CELAMBARASAN
Partner - Champion
Partner - Champion

Rows gets duplicated in your interval macth function? due to joins.