It can also be a good idea to consider creating new column for your weeks (might make it simpler for you to solve) and then use that and you can easily create this column using Recode
Then create your grouping column with a formula (using same formula as Jim but "newly" created column W)
Col Cumulative Sum(:W != Lag(:W))
and then you can create summary (this can be built in many different ways depending on how you want to select your values), change Group order, select first two rows from summary and create your subset from your original table
dt_summary << Select Rows([1, 2]);
dt_subset = dt << Subset(Selected Rows(1), columns(:FYW));
Close(dt_summary, no save);
-Jarmo