Looking at you output example, focusing on week 5, it seems like the Week to date is actually WeekMonth to date. Is this correct?Eatherway, here's my attempt to solve your problem. This will give you both Week to date and WeekMonth to date:select a.WeekIndex ,a.MonthIndex ,a.YearIndex ,sum(case when b.WeekIndex=a.WeekIndex then b.Unit_Sold else 0 end) as Unit_Sold_WTD ,sum(case when b.WeekIndex=a.WeekIndex and b.MonthIndex=a.MonthIndex then b.Unit_Sold else 0 end) as Unit_Sold_WMTD ,sum(case when b.MonthIndex=a.MonthIndex then b.Unit_Sold else 0 end) as Unit_Sold_MTD ,sum(b.Unit_Sold) as Unit_Sold_YTD from (select WeekIndex ,MonthIndex ,YearIndex from table1 group by WeekIndex ,MonthIndex ,YearIndex ) as a inner join table1 as b on b.YearIndex=a.YearIndex and b.MonthIndex<=a.MonthIndex and b.WeekIndex<=a.WeekIndex group by a.WeekIndex ,a.MonthIndex ,a.YearIndex order by a.WeekIndex ,a.MonthIndex ,a.YearIndex