Wow, you like leaving things in limbo, two months since originally asking this question.
Please consider reviewing the OOTB report Project Status Summary, which has a sub-report Status Summary Report, which has better logic on how each period should be created, which then calls additional sub-report for that Period. Quickly looking through the code you have originally attached, you are attempting to do a lot with you sub-report, where the sub-report has a lot of logic relating to 'if period is between X - Y, then column1 etc'. The sub-report can be called multiple times, including passing parameters to define the period required.
I couldn't make sense of your sub-report, as there is just too much logic relating to where to put the data, eg:
MAX($P!{dwhDBSchema}.dwh_null_number_fct(a.avail_1,0)) AS avail_1,
..
MAX($P!{dwhDBSchema}.dwh_null_number_fct(a.avail_12,0)) AS avail_12,
MAX($P!{dwhDBSchema}.dwh_null_number_fct(d.demand_1,0)) AS demand_1,
MAX($P!{dwhDBSchema}.dwh_null_number_fct(d.demand_2,0)) AS demand_2,