Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Trouble setting up Proper Date Calc


rsb87

Recommended Posts

I'm trying to create a date calculation that takes an inventory item that has an expire date. For instance, if the item has an expire date in let's say 6 months, the user will enter a start date and then the Calc field will automatically take the start date and then add the 6 months to give you the expiry date. It seems to work ok when I originally set it up, but when I try and change the date to an earlier date in the previous year to make the item "Expired" the End calc doesn't change the year to the proper one. Any ideas?

 

Thanks,

 

RSB87

Link to comment
Share on other sites

Sorry here is the calculation that I'm currently using:

 

End Date = Date(Month(start) + Subscriptions::Subscription_Duration, 15, Year(Today))

 

thanks,

 

RSB87

Link to comment
Share on other sites

As you have noticed, your equation will run into trouble when you have a case where the start month plus duration is greater than 12 (goes into another year).

 

I would suggest you use a formula such as this...

 

Case( Month(date) + Subcription::sub_dur >12, Date((Month(date) + Subcription::sub_dur)-12, 15, Year(date)+1), Date(Month(date) + Subcription::sub_dur, 15, Year(date)))

 

I would also recommend you avoid the TODAY function and use Status(CurrentDate) instead.

 

Because the calculation references a related value, you cannot turn indexing on/off, thus the default will be calculate when needed.

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use