Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I keep getting the following error message in my calendar script:don't see where there is a problem:
Error in expression: ')' expected
I have narrowed it down to this part of the script that is causing the problem:
LET vYTD= Floor(MakeDate(Year(Today()), (Month(Today())-1), Day(MonthEnd(Today()))-1));
If(InYearToDate(Date, $(vYTD), 0)
or InYearToDate(Date, '12/31/2013', -1)
or InYearToDate(Date, '12/31/2013', -2)
or InYearToDate(Date, '12/31/2013', -3)
or InYearToDate(Date, '12/31/2013', -4)
, 1, 0) as _YTD,
If(InYearToDate(Date, $(vYTD), 0)
or InYearToDate(Date, $(vYTD), -1)
or InYearToDate(Date, $(vYTD), -2)
or InYearToDate(Date, $(vYTD), -3)
or InYearToDate(Date, $(vYTD), -4)
, 'YTD') as YTD,
The following will give you the end date of last month:
LET vYTD = Monthend(Addmonths(today(),-1));
The makedate() in this expression is:
makedate(2014,0,30) - that is month is 0 (January minus 1), hence the error.
If you want it to be the end of the previous month, use
=monthend(today(),-1)
Hi,
You add expression in text box and check it out..
My YTD field doesn't populate with this variable:
LET vYTD =monthend(today(),-1)
If(InYearToDate(Date, $(vYTD), 0)
or InYearToDate(Date, $(vYTD), -1)
or InYearToDate(Date, $(vYTD), -2)
or InYearToDate(Date, $(vYTD), -3)
or InYearToDate(Date, $(vYTD), -4)
, 'YTD') as YTD
Change it a little, add floor():
LET vYTD =floor(monthend(today(),-1))
Edit: Some explanation.
Without floor, the variable returns date in format 12/31/2014. When you use it this way - $(vYTD), it is calculated as 12 divide by 31 divide by 2014. Not what you want. So, you either use floor to keep it numeric, as it was before (the value of this date is 41639), or change all your $(vYTD) in expression to simple vYTD, so it doesn't calculate. I think it is easier to change in one place.