Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
streetyhk
Contributor II
Contributor II

Adding a query in dataload to filter based on a date range ( - 18 mnths)

I am trying to add a query in dataload editor  (we are connected to Salesforce) to show records who have donated in the last 18 months.

The field LastCloseDate is the one that identifies whether there is a donation (if this is not NULL) and if there has been a donation when the most recent donation was made. 

Based on this, for any particular time range we select eg if we are looking at our data based on Months - we want to look at those records which have a date in the LastCloseDate field that is within the 18 months prior to the end of the month that we are looking at.

This is what we have so far.  (I think we need to change 18 to 547  - or is there a better way to state 18 months for the calculation as it will not always be 547 days)

 

DonatedLast18Months:

LOAD [LastCloseDate] FROM Staff;

INNER JOIN(DonatedLast18Months) LOAD [EndDate HKT] FROM VolHours;

When [LastCloseDate] >= [EndDate HKT]

and [LastCloseDate] <= ([EndDate HKT] -18);

Drop Table DonatedLast18Months;

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

You can use addmonths() to calculate a date X month away.

Try this:

 [LastCloseDate]  >= Addmonths([EndDate HKT], -18)

View solution in original post

1 Reply
Vegar
MVP
MVP

You can use addmonths() to calculate a date X month away.

Try this:

 [LastCloseDate]  >= Addmonths([EndDate HKT], -18)