Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
craig157
Creator II
Creator II

Id Exists during date range

Hi All,

Having trouble on this one but it may just be the way I'm phrasing this so hopefully it makes sense.

I have three fields - StartDate, EndDate & DateRange (please note EndDate will be null for lots of data)

IdStartDateEndDateDateRange
A115/07/201829/09/201815/07/2018-29/09/2018
A204/01/2018Null04/01/2018-
A312/12/201701/09/201812/12/2017-12/10/2018
A405/04/2018Null05/04/2018-

I've got listbox filters I use on some of the charts to narrow down the data.

But problem is, I need to have a count of active records during a certain period.

So if I select 'July 2018' my result should be 4, Select 'Jan 2017' should be 0, Select 'Dec 2017' should be 1, Select 'Today' should be 2

How would I achieve the count?

Thanks

2 Replies
swuehl
MVP
MVP

Create reference dates for your intervals (you can set the EndDate without a value for example to Today(1) in the script, or any other appropriate date):

Creating Reference Dates for Intervals

craig157
Creator II
Creator II
Author

I've ended up setting a Stored Procedure in the SQL table and just executing that to Qlik.

Just using the below:

AssetCount:

sql exec ('[dbo].[usp_InScopeMonth]');

Only downfall is now my dates don't relate to the Original Date Selector as I didn't want to create any loops in the Script.