Following on from the previous parts of this series (which looked at the basics of Temporal Reasoning and Temporal Functions), this third post continues our investigation of temporal calculations in general, this time with a focus on another series of functions and concepts, that are closely involved in using temporal data to calculate numeric or currency amounts.

In the previous chapter of this series, we saw how the functions such as WhenLast() give us the capability to investigate the temporal data at our disposal and find out what was happening on a given date, according to the information you have.

### How much would I have saved if?

Taking the example from the previous post and turning it upside-down, we can use Oracle Intelligent Advisor to find out how much money would could save if we had been good and put money in our bank account. There are two principles here :

- We need to know how much money we are willing to save
- We need to know how regularly we are willing to put it in the bank account.

In real life, you might say to me:

“Richard, if I saved $1 a day, every day, since the beginning of the year : – how much money would I have now?”

In Oracle Policy Automation we can ask the same sort of question. And of course, get the answer. The key points here are the *daily* sum, and the date range. In a sense, you are creating your own change points *daily* in order to calculate the result.

Again, it probably will not surprise you to know that there are a whole raft of Temporal Reasoning functions that work in similar ways to this one. Suppose you admit to me, that you cannot save money on the weekend, because you like to go out and spend it instead.

“Richard, if I saved $1 a day every week day since the beginning of the year:- how much money would I have now?”

Your familiarity with Oracle Policy Automation probably helps you guess that the function **IntervalDailySumIf** exists, so you decide to use it, as in the example below.

At first glance, this looks alright. *But it really isn’t*. The problem is a common one when imagining Temporal Reasoning. The Boolean attribute “you are not spending the money instead” is not going to be very useful, since it is not a temporal value. You get to set it once in the Debugger – not for every weekend:

So mixing a Boolean and our temporal calculation produces a not very useful result. But thankfully Oracle Policy Automation can help. It includes a function to let us know if a day is a weekday or not, based on a range of dates. It returns a set of values that illustrate the changes. It is another example of a temporal reasoning function.

In the above case, *the day is a weekday* returns a set of change points showing you the way:

In the next episode of this series, we will look at the display of Temporal data to the end user, in a way that is easily readable. If you want to formalize your Temporal Reasoning learning experience, check out our new Oracle Intelligent Advisor Temporal Reasoning training course.

Have fun.