Community perspective: Time Settings impact on PERIOD function

BrentOrr
edited December 2023 in Blog

When changing the model calendar or available time ranges beware of the unintended consequence on any PERIOD functions in your model. Here are the details on what caused a phantom issue at a customer and how we solved it.

Problem

While working with a customer to reduce model size we took a hard look at how they were using time. They had too many years of history that they did not use or need. So, our first pass was to reduce the history and eliminate unused time ranges. This immediately reduced model size by about 25%. Big win. However, weeks later, the customer came across an odd issue where date calculations in an employee module were not always calculating correctly. After tracing the errors back they all seemed to involve the PERIOD function. At the time it seemed intermittent because 70%+ worked while the rest failed. Once the data was extracted and analyzed we realized that the failures were all on employees that had an older ‘start date’. Still finding the PERIOD function at the center of the issue I did a careful reading of the Anapedia entry:

The important part for our situation was the model time setting. By restricting the years of history in the model we had shortened the “time bounds of the model” and the PERIOD function did not know how to handle a date that fell outside the time bounds. 

Solution

To solve the issue, I added a time range that went back far enough to cover all employee start dates. 

 I also made sure to add a note in naming the time range to not delete it. Since it is not actually used anywhere in the model, a future admin might mistakenly think it could be deleted.  This also has the benefit of taking no space. The model calendar did NOT have to be extended.

Takeaway

Anytime your model has dates that are ‘old’ relative to the time range of the model, or will ‘age out’ eventually, you should set up a time range to prevent the issue down the road. Future admins may not even be aware, but they will appreciate it.

 

 

Comments

  • Great tip! We had something very similar and thought that it wouldn't work having the time period as outside the "Main Calendar" but it did.