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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count between 2 dates

I am trying to count the number of CATEGORY=EM calls we have between 2 dates.

I am able to use set analysis to derive the dates, which I've put in separate columns in my chart for debug purposes.  These are as follows:

To get the latest date:

only({<METER_NO={'1','METER1','Black','BLACK','A4BLACK'}, READINGS_READING_DETAILS_Z_ASSOC_ROW={'1'}>}DATE_READ)

To get the 4th old reading:

only({<METER_NO={'1','METER1','Black','BLACK','A4BLACK'}, READINGS_READING_DETAILS_Z_ASSOC_ROW={'4'}>}DATE_READ)

This is where it becomes a little too complex for me.  I know this is a very dumbed down example of how to count between 2 dates, but I somehow need to stitch the 2 pieces of set analysis in.

count({<DATE_READ={"$(= '>=' & '01/01/2010' & '<=' & '31/12/2012')"}>} distinct SERIAL)


Any help would be gratefully received.

3 Replies
SunilChauhan
Champion II
Champion II

count({<DATE_READ={">=$(=datefield1) <= $(=datefield2)"}>} distinct SERIAL)



or


count({<DATE_READ={">=$(='01/01/2010') <= $(='31/12/2012)"}>} distinct SERIAL)



hop ethis helps

Sunil Chauhan
Not applicable
Author

Do you mean create variables for the 2 date selections?

SunilChauhan
Champion II
Champion II

yes

or

you can use getfieldselections() function

Sunil Chauhan