Human Capital Management Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
altugatas
Explorer
2,352

Introduction

Business rules in time off can be tricky based on the customers' requirements, and rounding of accruals may be one of them. There are couple of notes and blogs regarding this topic. (The most generic one can be found here.) In this article, I wanted to share a bit more complicated example with detailed explanations. You will see that the business rule is straight-forward easy; and compared to that, the scenario requires more attention.

Scenario
In our example, employee earns total of 20 days of accrual within a year. We want to have a hire and/or a termination rule, and want to recalculate accruals based on couple of conditions.

If the employee worked for a full year, the accrual will be 20 days, and will be prorated based on applicable months. As an example, for 10 months of work, the prorated amount will be: 20 / 12 x 10 = 16,67.

Note: The calculation of the total number of months within a year where employee was applicable for accrual is not the subject of this article. This value will be stored in a standard variable, which will be used within a business rule.

By looking at the example above, we can then create a table as follows:

Months123456789101112
Accrual1,673,3356,678,331011,6713,331516,6718,3320

Now comes the tricky part: The customer wants to change its approach and adjust these amounts, so that:

  1. Decimals below 0,25 should be rounded to 0.
  2. Decimals between 0,25 to 0,75 should be rounded to 0,5.
  3. Decimals above 0,75 should be rounded to 1.

So the desired accrual amounts will be as follows:

Months123456789101112
Accrual1,53,556,58,51011,513,51516,518,520

The following section will be about how to achieve this.

Implementation

The business rule that we are going to use can be found below.

01_BusinessRule.png

Now let us breakdown the rule in details.

  1. The number of months is our variable as mentioned before, and this stores the total number of applicable months. This value is then multiplied by the results of 20 / 12.
  2. Then we multiply this result by 2. The 2 here is selected because it will help us with rounding the decimals later on, as there are 2 x 0,5 within 1, and we want decimals to be either 0, or 0,5.
  3. Afterwards we round the decimals, and lastly we divide the value by 2 again, as we already multiplied them.

The result of these operations can be found below:

Months123456789101112
Accrual1,673,3356,678,331011,6713,331516,6718,3320
x 2 3,336,661013,3316,662023,3326,663033,3336,6640
Round3710131720232730333740
/ 21,53,556,58,51011,513,51516,518,520

As seen, we now have the desired results, and job's done!

If you have different rounding criterions, you can easily adjust the number 2 we used above, and change this value according to your requirements. As an example, if you want to round the accruals to the closest 0,2 fractions, then you can use number 5 while multiplying and dividing.

Months123456789101112
Accrual1,673,3356,678,331011,6713,331516,6718,3320
x 58,3316,662533,3341,665058,3366,667583,3391,66100
Round817253342505867758392100
/ 51,63,456,68,41011,613,41516,618,420

 

Summary

I always have fun during adjusting the business rules and brainstorm about such calculations. I hope that this article will be helpful for you during your projects! Please also check the other blogs related to this topic.

Also please feel free to give feedback or comment.

Best,
Altug

2 Comments