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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help needed with expression for data that falls within 2 date ranges

Hello,

I want to split our supporters into active and inactive groups - Active is defined as someone who has made a donation in the past 6 years, inactive as one who has not. What expression do I need to use to get to this?

Many thanks

Lindsay

5 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try below expressions

Active:

=Count({<Date={'>=$(=AddYears(Today(), -6))'}>} Supporter)

Inactive:

=Count(DISTINCT Supporter)  -

Count({<Date={'>=$(=AddYears(Today(), -6))'}>} DISTINCT Supporter)

Hope this helps you.

Regards,

jagan.

Not applicable
Author

To get the list of supporters try to use inner join, i.e. for active supporters:

People:
LOAD * Inline [

uid, name
1, John
2, Peter];

Donations:
LOAD * Inline [

uid, donation_date
1, 2012-01-01
2, 2001-01-01];

ActiveSupporters:
LOAD uid, name as name_active
Resident People;
Inner Join
LOAD uid
Resident Donations
Where Date(donation_date) > AddYears(Today(), -6);


Not applicable
Author

Thanks for the prompt reply. I couldn't get either suggestions to work.

The DATEDUE field (used against payments) formats dates as 4/10/200 12:00:00 AM - would that affect the expression above?

It's been a year since I looked at expression writing - bit rusty!

Thanks so much,

Lindsay

Not applicable
Author

Use Date and Date# functions:

Date(Date#(donation_date, 'M/D/YYYY hh:mm:ss tt'))

jagan
Partner - Champion III
Partner - Champion III

Hi,

While loading arrive num field for date by using

Num(DateField) AS DateNum

Now use this DateNum field in set analysis.

Try below expressions

Active:

=Count({<DateNum={'>=$(=Num(AddYears(Today(), -6)))'}>} Supporter)

Inactive:

=Count(DISTINCT Supporter)  -

Count({<DateNum={'>=$(=Num(AddYears(Today(), -6)))'}>} DISTINCT Supporter)

Hope this helps you.

Regards,

jagan.