Fast Formula for Pro-Rated Accrual Balance

Purpose of the tutorial

If an employee’s length of service exceeds one year, the employee will be entitled to an accrual balance of 12 days. If the employee’s length of service is one year or less, the accrual will be calculated based on the actual duration of service, in the same manner as for a resigned employee.

Fast Formula section

/**********************************
FORMULA NAME:Extra Leave Accrual Formula
FORMULA TYPE: Global Absence Accrual Matrix
DESCRIPTION: Calculate accrual balance

**********************************/
DEFAULT FOR ACP_HIRE_DATE IS ‘4712/12/31 00:00:00’ (date)
DEFAULT FOR IV_CALEDARENDDATE IS ‘4712/12/31 00:00:00’ (date)
DEFAULT FOR IV_CALEDARSTARTDATE IS ‘4712/12/31 00:00:00’ (date)
DEFAULT FOR PER_REL_ACTUAL_TERMINATION_DATE IS ‘0001/01/01 00:00:00’ (date)
INPUTS ARE IV_ACCRUALPERIODSTARTDATE(DATE),
IV_ACCRUALPERIODENDDATE(DATE),IV_CALEDARENDDATE (date),IV_CALEDARSTARTDATE(date)

total_month=12
service_length_month=MONTHS_BETWEEN(IV_ACCRUALPERIODENDDATE,ACP_HIRE_DATE)
if (service_length_month>=12) THEN(
accrual=12
)
ELSE (
Accrual=12/total_month*service_length_month

)

IF (PER_REL_ACTUAL_TERMINATION_DATE < IV_CALEDARENDDATE and PER_REL_ACTUAL_TERMINATION_DATE >= IV_CALEDARSTARTDATE)
then
(
no_length_ser=MONTHS_BETWEEN(PER_REL_ACTUAL_TERMINATION_DATE,IV_CALEDARSTARTDATE)
Accrual=12/total_month*no_length_ser
)

RETURN Accrual

Important Note: If an employee has resigned and the transaction has not yet been approved, the termination date will not be stored in PER_REL_ACTUAL_TERMINATION_DATE. In this scenario, we need to create a value set to fetch the termination date and then call that value set within our fast formula.

Like :- L_LWD_DATE= GET_VALUE_SET('VALUE_SET_NAME','|=PERSONID='''||to_char(L_PERSON_ID) ||''''||'|VALUE_SET_DATE='''||to_char(CURRENT_DATE,'YYYY/MM/DD')||'''')      

Scenario 1:- The employee was hired on January 20, 2025. As the employee’s length of service exceeds one year, the employee is entitled to an accrual balance of 12 days.

Fast Formula

Scenario 2:- The employee was hired on Sep 21, 2026, the employee’s length of service is less than one year, so the employee would not receive the full 12-day accrual balance. The accrual should be calculated based on the actual duration of service

Scenario 3:-Employee resigned on sep 30/2026 so the accrual balance will be calculated based on the employee’s actual period of service, up to the employee’s last working date in the system.

For SQL/BI Reports you can click here

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top