
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MakeDate 6 Months Ago
Hi,
I want to make a change to the MakeDate(2015,03) so that it always 6 months previous of todays date but not sure how to do this, as at the moment I am having to hard code the values and was looking at variable to replace the Year and Month?
FOR i = 1 to 6
LET vDate$(i) = Date(AddMonths(MakeDate(2015,03),i-1),'DD-MMM-YYYY');
Thanks
- Tags:
- new_to_qlikview

.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
let v6MonthsAgo= Date(Addmonths(Today(),-6));
...This would give you a date 6 months back from today's date. If you do this in the load script, it would only be updated when the script runs.
If you use this, it will evaluate dynamically based on today's date whether the app was reloaded that date or not.
set v6MonthsAgo= Date(Addmonths(Today(),-6));
or you also can do it in the UI variables.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so with my current script I have what do I need to change?

.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your current script creates 6 different variable from 1 to 6 months prior from a hardcoded month of 201503.
Based on your description you just need 1. You can use this to do that and instead of a hard coded date, make it dynamic to today's date
set v6MonthsAgo= Date(Addmonths(Today(),-6));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry yes I still want it to do the multiple months as with my script it does a loop but I want it to always start 6 months ago, so basically I want it to loop through the following dates:
01-MAR-2015
01-APR-2015
01-MAY-2015
01-JUN-2015
01-JUL-2015
01-AUG-2015
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
FOR i = 1 to 6
LET vDate$(i) = Date(MonthStart(Today(),-$(i)),'DD-MMM-YYYY');
Next
