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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count the active days, grouped by user, year and month

Hi, i need to count the active days (the interval of EndDate and InitialDate) and group them by User, Year and Month. If the EndDate is null then it means is still active so it must use the last day of the active month (actually 31 december)

InitialDate is => 01/07/2011

UserInitialDateEndDate
101/07/201110/09/2011
201/07/2011
305/07/201111/10/2011
410/08/201120/12/2011
510/08/2011
608/11/201109/11/2011
708/11/2011

The expected data is:

UserJulAgoSepOctNovDec
1313110000
2313130313031
32731301100
402230313020
502230313031
6000020
700002331

Hope you can help me.

Regards

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hei

have a look at this example

i used intreval match for the calculation

View solution in original post

3 Replies
lironbaram
Partner - Master III
Partner - Master III

hei

have a look at this example

i used intreval match for the calculation

rohit214
Creator III
Creator III

hi

try this

to count the active days

=count(if(len(enddate)=0 or isnull(enddate)='-1',enddate))

then in script write

load

month(field) as month,

year(field) as year,

user

from xyz.qvd group by user,year;

use pivot table choose

dimension user,month

streach month column and you will get your ans

thanks

rohit

Not applicable
Author

Great!! I have to do some changes but it's doing what i need.

Thanks!