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

? set analysis; Count distinct whith calculation of days difference

Hi, working my way through set analysis

Im trying to count the occurences in my data set where the number of days between two date fields is more than 21 days, I tried something like:

 

=Count({<[Dt Cons Rec solution]-WO_Date>{'21'>} DISTINCT [Unique reference number#])

But this is not doing the trick, any suggestions?

mistake in expression posted: i used

 

 

=Count({<[Dt Cons Rec solution]-WO_Date>{'21'}>} DISTINCT [Unique reference number#])

 

1 Solution

Accepted Solutions
Not applicable
Author

Sure, perhaps I was missing a set of brackets:

if(Dt Cons Rec solution]-WO_Date > 21, count(DISTINCT([Unique reference number#])))

This sintax returns accurate results on a data set of mine, so hopefully will work. If not, you could always post a sample qvw for us to try it out on.

Best,

Matt

View solution in original post

7 Replies
Not applicable
Author

Perhaps this will work:

if(Dt Cons Rec solution]-WO_Date > 21, count(Distinct [Unique reference number#]))


Best,

Matt

Not applicable
Author

Thanks for the suggestion Mattsies, afraid though this is not doing the trick. Any more suggestions?

Not applicable
Author

Rob Wunderlich has a great document in his cookbook that will help you.  If you go to his site here: http://robwunderlich.com/downloads/, download the Cookbook and look in Cookbook.qvw.  The description is "Count days in a transaction using interval match".

Not applicable
Author

Thanks for the suggestion Mattsies, afraid though this is not doing the trick. Any more suggestions?

Not applicable
Author

Hi Rebecca,

thanks for this site, i tried to solve it in the frontend, where scription would make things easier. Just hoped to see how this could be solved via Set Analysis in the front end....

Not applicable
Author

Try something like this:

Count(DISTINCT if(EndDate-StartDate>=21, ID))

Not applicable
Author

Sure, perhaps I was missing a set of brackets:

if(Dt Cons Rec solution]-WO_Date > 21, count(DISTINCT([Unique reference number#])))

This sintax returns accurate results on a data set of mine, so hopefully will work. If not, you could always post a sample qvw for us to try it out on.

Best,

Matt