evidently, as stated in the parser response, a column name is needed for both cases. In either versions the columns of "d" are not named.
in case 1: your column 2 of d is sum(totalitems)
which is not named. duration
will retain the name "duration"
in case 2: both month(clothdeliverydate)
and SUM(CONVERT(INT, deliveredqty))
have to be named