Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Calculations

Hi,

I am trying calculate dates 6 months backward in one expression and one month backward in another expression based on selected variables which are month and year.

The below expressions works fine for any selected month and year above from July to December. When i select any months between Jan and June i am not getting any values.

Think the issue is with the year as it is going to year before, i am not sure how to resolve it, any thoughts?

expression 1: MakeDate(($(vYear)),$(vMonth)-6,01)

expression 2: MonthEnd(MakeDate($(vYear),$(vMonth)-1,01))

jagan

Regards,

Karthik

7 Replies
Anonymous
Not applicable
Author

Hi  Try it.

expression 1: Addmonths(MakeDate(($(vYear)),$(vMonth),01),-6)

expression 2: Addmonths(MonthEnd(MakeDate($(vYear),$(vMonth),01)),-1)

Regards

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this, if you are using this in Load script $ is required otherwise no need of $.

expression 1: AddMonhs(MakeDate(vYear), vMonth), -6)  // No need of

expression 2: MonthEnd(MakeDate(vYear, vMonth), -1)

Hope this helps you.

Regards,

jagan.

Not applicable
Author

Thank You.

Not applicable
Author

Thank you.

jagan
Luminary Alumni
Luminary Alumni

Hi Karthik,

Did you got the answer?  If you get the answer please close this thread by giving Correct and Helpful answers to the post which helps you in getting the answer.

Regards,

Jagan.

Not applicable
Author

Hi Jagan Garu,

Yes it worked, i am able to mark it as helpful under actions but i cant see any correct answer button?

Regards,

Karthik.

jagan
Luminary Alumni
Luminary Alumni

HI Karthik,

Goto this link and try

Date Calculations