 # Time slices in Utilities

Time slices

Time slices is an important concept in EDM. Several issues which I have encountered stems from an incorrect time slice selection or comparison, these incorrect time slices issues may be difficult and tricky to find, therefore it is recommended to use the correct time slice selection right from the start.

There can be several time slices scenarios in EDM which will be documented below. For time slices comparison there will always be 2 slices to compare. The slice below is known as the reference time slice, which means that any slices which falls within this reference time slice is required to be processed. An example of how a reference time slice spans is below. (AB = start date, BIS = end date)

The below examples would be the scenarios which may happen when processing time slices. There are total of 9 possible scenarios. The yellow box will represent the 2nd time slice.

Scenario 1 : Start date < AB and End Date < BIS Scenario 2 : Start date > AB and End Date > BIS Scenario 3 : Start date > AB and End Date < BIS Scenario 4 : Start date < AB and End Date > BIS Scenario 5 : Start date = AB and End Date > BIS Scenario 6 : Start date < AB and End Date = BIS Scenario 7 : Start date = AB and End Date = BIS Scenario 8 : Start date = AB and End Date > BIS Scenario 9 : Start date > AB and End Date = BIS In order to achieve the time slice comparison of all 9 scenarios, the condition would be quite lengthy.

IF (Start date < AB and End Date < BIS) OR

(Start date > AB and End Date > BIS) OR

(Start date > AB and End Date < BIS) OR

(Start date < AB and End Date > BIS) OR

(Start date = AB and End Date > BIS) OR

(Start date < AB and End Date = BIS) OR

(Start date = AB and End Date = BIS) OR

(Start date = AB and End Date > BIS) OR

(Start date > AB and End Date = BIS).

In order to shorten these 9 scenarios, the code below can be used.

IF (Start date <= BIS and End date >= AB)

The below table will confirm the validity of the shortened code for the 9 scenarios.

 Scenario Reference time slice code Shortened time slice code Valid? 1 Start date < AB and End Date < BIS Start date <= BIS  and End Date >= AB Y 2 Start date > AB and End Date > BIS Start date <= BIS  and End Date >= AB Y 3 Start date > AB and End Date < BIS Start date <= BIS  and End Date >= AB Y 4 Start date < AB and End Date > BIS Start date <= BIS  and End Date >= AB Y 5 Start date = AB and End Date > BIS Start date <= BIS  and End Date >= AB Y 6 Start date < AB and End Date = BIS Start date <= BIS  and End Date >= AB Y 7 Start date = AB and End Date = BIS Start date <= BIS  and End Date >= AB Y 8 Start date = AB and End Date > BIS Start date <= BIS  and End Date >= AB Y 9 Start date > AB and End Date = BIS Start date <= BIS  and End Date >= AB Y

### Assigned Tags

You must be Logged on to comment or reply to a post. Nice one. i liked it! Nice.

Two questions:

• Isn't scenarios 5 and 8, the same?
• If Scenario 9 (Start date > AB and End Date = BIS) is considered, then shouldn't be considered as well a scenario like "Start date = AB and End Date < BIS"?

J.