Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
zototo
Contributor III
Contributor III

Limit data load till previous month

Hi everyone, 

It seems quite easy, but I cannot solve one problem: I need to limit the data load period from one date to the previous month. The app has to be reloaded on the 5th calendar day, which also gives me these 4 days of a current month which I don't need. 

I'm using this to limit years and it works fine:

set vNumberOfYearsToLoad = 2;

let vBaseDate = num(today());
let vStartDate = AddYears(YearStart($(vBaseDate)),$(vNumberOfYearsToLoad)*-1);

To limit till the last month tried these and haven't succeded:

let vBaseDate = MonthEnd(today(),-1);
let vBaseDate = (Month(Date(Max(Date)))-1);
let vBaseDate = MonthEnd(Max(Date),-1);

Thank you for any ideas!

 

 

 

Labels (4)
2 Replies
anat
Master
Master

let vBaseDate = MonthEnd(addmonths(today(), -1)) 

zototo
Contributor III
Contributor III
Author

I tried to re-write variables a bit and it almost works. The only thing is that it deducts the last day of the previous month and have no idea how to avoid it. 

This is what I have now:

Let vMinDateFY=YearStart(Today(),-1);
Let vMaxDateFY=Today();
Let vMaxDateFY=MonthEnd(today(),-1);
Let vMaxDateFY=MonthEnd(addmonths(today(), -1));