Home > FAQ > Data Manipulation > Date Rounding in Expressions > Beginning of the next ... examples > Beginning of the next plan year

Beginning of the next plan year

This is the recommended expression for rounding dates to the beginning of the next plan year:

BOY1_DT:= #NEXTBEGMTH (2 #LSTBUSDAY A_DT) &
; find the last business day of the current plan year, then round that last business day
; to the beginning of the next month (i.e., 1/1)

A_DT may be either a single date (e.g., 7/16/2015, DOH, #DODEC) or an array of dates (e.g., #DATE).

We start with #LSTBUSDAY because it's the easiest way to work with plan years, but then we need to use #NEXTBEGMTH to guarantee that we are at the beginning of the next plan year. 2 #LSTBUSDAY A_DT finds the last business day of the current plan year, which is one of the last 3 days of the current plan year, depending on whether the last day of the current plan year is a weekday, Sunday or Saturday. Then #NEXTBEGMTH converts it to the first day of the next month (i.e., the first day of the next plan year).

 If you have already have calculated the end of the current plan year for each date in A_DT (e.g., stored in EOY_DT), then simply adding 1 day gives you the beginning of the next plan year:

BOY1_DT:= EOY_DT + 1 &