

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Creation of Monthend/MonthsStart as Parameter in Let / Set Function
Hi,
I wish to create parameter value of MonthStart & MonthEnd, whereby value for 'From' and 'To' are formulated from value in 'Date' as below:
Set Date= '20170204';
Let From = Date(MonthStart(Date#($(Date),'yyyyMMdd')),'YYYY-MM-DD');
Let To = Date(MonthEnd(Date#($(Date),'yyyyMMdd')),'YYYY-MM-DD');
Expectation Result:
$(Date) = 20170204
$(From) = 2017-02-01
$(To) = 2017-02-28
Actual Result:
$(Date) = 20170204
$(From) = 2014
$(To) = 1987
Can anybody assist me to do the parameter set-up.
regards.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Possibly your variable values are correct, only thing is while you are expanding them using $, they are getting evaluated, like:
$(From) = 2017-02-01 -> 2017 minus 02 minus 01 -> 2014
$(To) = 2017-02-28 -> 2017 minus 02 minus 28 -> 1987
Try not expanding them using $, but call directly without it (direct variable names) in another expression.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be this?
SET Date = MakeDate(2017,02,04);
SET From =Date(MonthStart(Date(MakeDate(2017,02,04),'YYYY-MM-DD')),'YYYY-MM-DD');
SET End = Date(MonthEnd(Date(MakeDate(2017,02,04),'YYYY-MM-DD')),'YYYY-MM-DD');
If not, Try simple in text object and then see
OR
SET Date = Date(MakeDate(2017,02,04),'YYYYMMDD');
SET From = Date(MonthStart(Date($(Date),'YYYY-MM-DD')),'YYYY-MM-DD');
SET End = Date(MonthEnd(Date($(Date),'YYYY-MM-DD')),'YYYY-MM-DD')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Possibly your variable values are correct, only thing is while you are expanding them using $, they are getting evaluated, like:
$(From) = 2017-02-01 -> 2017 minus 02 minus 01 -> 2014
$(To) = 2017-02-28 -> 2017 minus 02 minus 28 -> 1987
Try not expanding them using $, but call directly without it (direct variable names) in another expression.
