Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
mr_novice
Creator II
Creator II

Calculate average session time

Hi All,

I have a simple table with these columns:

User, SessionDuration

A, 00:37:01

B, 01:40:02

.....

I would like to create a chart that shows the average session time vs the share/proportion of users. Y-axis shows average time and X-axis shows the proportion of users in % like this: 0% 10% 20%

Is this possible? How?

Thankful for any suggestion..

Br

Chris

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

I think to do that , your class expression would be the 'calculated dimension' and count(distinct [User]) would be the expression.

When used as a  dimension you add the dimensional context using the aggr() function. Like this:

classaggr( avg(SubField([Session Duration],':',1)*60+SubField([Session Duration],':',2))  , [User])  ,10)

View solution in original post

3 Replies
mr_novice
Creator II
Creator II
Author

Ok, another approach -  I did this in a Straight Table:

Dimension - User

Expression: class(avg(SubField([Session Duration],':',1)*60+SubField([Session Duration],':',2)),10)

Now this gives me a table like this:

User, Range

A, 90<=x<100

B, 90<=x<100

C, 80<=x<90

..

..

Now I would like to count the users within each range so I get this:

Count(user), Range

2, 90<=x<100

1, 80<=x<90

..

..

How can I do this? I have been trying with "aggr"-funtion but I dont get it to work....

Any suggestions?

JonnyPoole
Employee
Employee

I think to do that , your class expression would be the 'calculated dimension' and count(distinct [User]) would be the expression.

When used as a  dimension you add the dimensional context using the aggr() function. Like this:

classaggr( avg(SubField([Session Duration],':',1)*60+SubField([Session Duration],':',2))  , [User])  ,10)

mr_novice
Creator II
Creator II
Author

Thank you Jonathan. Works great! I did it wrong with the aggr() on the outside.