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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load only last X months - using a variable

Hi,

I want to load only data since last 3 months,

so in the script, I am using:

Let vLast3Months = AddMonths(today(),-3);

Table:

LOAD CampaignID,

          CreationDate as [ExportDate]

FROM XXX

WHERE CreationDate>=$(vLast3Months);   // I use $() since it's a date variable

But it's not effecting my load, what's wrong?

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

My guess is the date format. Try converting it to a number:


Let vLast3Months = num(AddMonths(today(),-3));


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

My guess is the date format. Try converting it to a number:


Let vLast3Months = num(AddMonths(today(),-3));


talk is cheap, supply exceeds demand