Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis using date range?

I have a requirment to count the number of customers that were contacted between two date ranges, I guess this can be done using set analysis however I am having problems with the syntax.  I appreciate any help?

Basically I have a field named CONTACT_MADE which holds date value in the following format 'DD/MM/YYYY'  I need to count how many customers were contacted between two date ranges e.g. between 01/01/2010 and 31/12/2012 ? (note: multiple rows per customer)

I appreciate any advice.

Thank you

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

For this specific date range:

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

In a more generic form, where you can use expressions for dates
count(<CONTACT_MADE={"$(= '>=' & date(startdate expression) & '<=' & date(enddate expression))"}>} distinct customer

Regards,
Michael

View solution in original post

3 Replies
Gysbert_Wassenaar

Easiest to create two variable, i.e vStartDate and vEndDate, and use those in the expression. Make sure the variables contain numeric dates. For example

vStartDate: date#('01/01/2010','DD/MM/YYYY')

vEndDate: date#('31/12/2010','DD/MM/YYYY')

The expression will then look something like:

count({<CONTACT_MADE={'>=$(vStartDate)<=$(vEndDate)'}>} distinct Customer)


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

For this specific date range:

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

In a more generic form, where you can use expressions for dates
count(<CONTACT_MADE={"$(= '>=' & date(startdate expression) & '<=' & date(enddate expression))"}>} distinct customer

Regards,
Michael

usamabinsadiq
Contributor III
Contributor III

Thanks, it helped me too.

if my replay helped you then please press like button and do not forget to press the "Accept as Solution" button.