The way to calculate the last day of the month is to use ‘<+CM>’ as the DateExpression parameter of the CALCDATE. You could pull the year and the month out of the 6 digit string into two separate integer variables, and build a date with the DMY2DATE function, and then use the CALCDATE function to calculate the last day of the month.