Hi Saurabh,
if you think 12 formulas would work fine for you, then you can have 0 columns for the months that are not in the range. Simple you can define a formula variable for each month with customer exit (say FV1). In the exit loop in the values selected for calmonth, for a formula variable say for january, if it exists in the selected months, assign 1 if not assign 0. In query designer, redesign your formula for January as FV1 * your_old_formula. Go on all months like this. This is not a nice solution but it would work.
Hope it gives an idea
Yasemin...
You can even hide the 0 columns by suppressing zeros on columns.