I have the following formula causing problems,
IF MONTH(CurrentDate)= 1 THEN
DateTime ({@LastYear}-1,12,31,0 ,0 ,0 )
ELSE IF MONTH(CurrentDate)-1 IN [1,3,5,7,8,10,12] THEN
DateTime ({@CurrYear},MONTH(CurrentDate)-1,31,0 ,0 ,0 )
ELSE IF MONTH(CurrentDate)-1 IN [4,6,9,11] THEN
DateTime ({@CurrYear},MONTH(CurrentDate)-1,30,0 ,0 ,0 )
ELSE IF MONTH(CurrentDate)-1 IN [2] THEN
IF {@LeapYearForCurrYear} = 'Y' THEN
DateTime ({@CurrYear},2,29,0 ,0 ,0 )
ELSE
DateTime ({@CurrYear},2,28,0 ,0 ,0 )
When I run the report I get the following error:
A day number must be between 1 and the number of days in the month.
Can anyone spot a problem with this formula?
IF MONTH(CurrentDate)= 1 THEN
DateTime ({@LastYear}-1,12,31,0 ,0 ,0 )
ELSE IF MONTH(CurrentDate)-1 IN [1,3,5,7,8,10,12] THEN
DateTime ({@CurrYear},MONTH(CurrentDate)-1,31,0 ,0 ,0 )
ELSE IF MONTH(CurrentDate)-1 IN [4,6,9,11] THEN
DateTime ({@CurrYear},MONTH(CurrentDate)-1,30,0 ,0 ,0 )
ELSE IF MONTH(CurrentDate)-1 IN [2] THEN
IF {@LeapYearForCurrYear} = 'Y' THEN
DateTime ({@CurrYear},2,29,0 ,0 ,0 )
ELSE
DateTime ({@CurrYear},2,28,0 ,0 ,0 )
When I run the report I get the following error:
A day number must be between 1 and the number of days in the month.
Can anyone spot a problem with this formula?