5 Replies Latest reply on May 15, 2012 1:49 PM by Tucker

# Calculation to get Date equal to Last Month, Last Year.

### Title

Calculation to get Date equal to Last Month, Last Year.

### Post

This should be simple but I'm having difficulty. I want to wirite a calculation that results in a date that is equal to the last day of last month, 1-year ago.

• ###### 2. Re: Calculation to get Date equal to Last Month, Last Year.

Would that be the last day of the previous month, but 1 year ago?

If so,

Let ( T = Get ( CurrentDate ) ;
Date ( Month ( T ) ; 0 ; Year ( T ) - 1 ) )

• ###### 3. Re: Calculation to get Date equal to Last Month, Last Year.

Thanks Phil. I managed to figure it out using:

Date(Month(Get ( CurrentDate )) -0;Day(Get(CurrentDate)) -Day ( Get(CurrentDate) ) -0 ; Year(Get(CurrentDate))-1)

This returns the last day of last month, 1-year ago. Perhaps the Let statement is easier but I'm not familiar with it yet.

• ###### 4. Re: Calculation to get Date equal to Last Month, Last Year.

The let function just lets me use T in place of get ( CurrentDate ) to avoid having to use it twice. You've got a lot of extra stuff in your calculation. You can simplify it to:

Date(Month(Get ( CurrentDate )) ; 0 ; Year(Get(CurrentDate))-1)

Which is the same as mine, but without the Let function.

• ###### 5. Re: Calculation to get Date equal to Last Month, Last Year.

Thank you Phil. That makes things much less complex!