The peek function can be used outside Load statements, typically in a Let statement, e.g. Let $(vToDate) = peek(...); The problem you face is to choose which record to use - you most likely have several end dates in the table. Try something similar to the following (just one value):
Load Max(Date) as EndDate resident FirstTable ;
Let vToDate = peek('EndDate',-1,'MaxDate');
Further, you should probably look at the Crosstable prefix to collapse your CDD01J .. CDD12J columns into one column.