Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
MalcolmCICWF
Contributor II

Create Variable that is Today -6 Months

I have the below in my script to create a variable that is the minimum and maximun date for my field. What would I need to change to make the variable identify 6 months from TODAY(). I want the Min variable to be 6 months in the past and the Max to be 6 in the future. I have modified it but cannot figure out the correct function to identify month.

LOAD
num(min(daystart(column_fields))) as MinPoolDate,
num(max(daystart(column_fields))) as MaxPoolDate


RESIDENT IRR_Data;

DROP TABLE IRR_Data;

LET vStartDate = Date(peek('MinPoolDate',0,'Temp'),'M/DD/YYYY');
LET vEndDate = Date(peek('MaxPoolDate',0,'Temp'),'M/DD/YYYY');


DROP TABLE Temp;


1 Solution

Accepted Solutions
Not applicable

Re: Create Variable that is Today -6 Months

LET vStartDate = Date(AddMonths(Today(),-6);
LET vEndDate = Date(AddMonths(Today(),6);

View solution in original post

2 Replies
mwoolf
Honored Contributor II

Re: Create Variable that is Today -6 Months

Use AddMonths()

Not applicable

Re: Create Variable that is Today -6 Months

LET vStartDate = Date(AddMonths(Today(),-6);
LET vEndDate = Date(AddMonths(Today(),6);

View solution in original post