CALCDATE INCORRECT CALCULATION

Hi.

I’m trying to use CALCDATE to calculate 1 month back after a posting date range is entered by a user.(see below)

StartDate := 010414D

EndDate := 300414D

LastSDate := CALCDATE(’-1M’,StartDate);

LastEdate := CALCDATE(’-1M’,EndDate);

After running the code it brings the following results :

LastSDate = 01-03-14

LastEDate = 30-03-14.

March Ends on the 31 as in 31-03-14. How can i adjust the CALCDATE formula so that if a month ends on 31, it goes to 31 and not 30?

Hi Douglas,

Composing the right calcdate expression can take some practice. You might want to build yourself a stub object to test various expressions to see how they effect the outcome.

For this specific case, I’ve tested CM+1D-1M-1D with good results.

You might also try -1M+CM. The idea is to get familiar with how various combinations and sequences of expressions produce different results. For a start, you might take a look at the DateFormula fields in the Payment Terms table, to see how they work.

Thank you for your response. I will try your suggestion