Home > FAQ > Data Manipulation > Date Rounding in Expressions > Use the plan year without actually knowing the plan year

Use the plan year without actually knowing the plan year

When working with plan years, #FSTBUSDAY and #LSTBUSDAY allow us to use the plan year (defined in the Plan Definition) without actually knowing what the plan year is. If we use these operators to work with plan year and someone later changes the plan year in the Plan Definition, we won’t have to change any expressions where we had to determine the plan year.

The expression 2 #FSTBUSDAY A_DT,gives us the first business day of the plan year. So, if the first day of the plan year is Saturday or Sunday, then #FSTBUSDAY returns the first Monday of the plan year (i.e., the 3rd or 2nd day of the plan year).  #BEGMTH rounds this date to the 1st of the month, the 1st day of the plan year.

BOY_DT:= #BEGMTH (2 #FSTBUSDAY A_DT) &

The expression 2 #LSTBUSDAY A_DT, gives us the last business day of the plan year. If the last day of the plan year is Saturday or Sunday, then #LSTBUSDAY returns the last Friday of the plan year (i.e., the 3rd or 2nd last day of the plan year). #ENDMTH rounds this date to the end of the month, i.e., the last day of the plan year.

EOY_DT:= #ENDMTH (2 #LSTBUSDAY A_DT) &