The main thing you need to resolve here is the definition of a week. If you simply say that, starting today and going back to 7*26 days is what you consider as the 26 weeks, then you can do it as follows:select clientId, SUM(case when period >= DATEADD(dd,datediff(dd,0,getdate()),-7*26) then hours end) as WeeksNowTo27, sum(case when period < DATEADD(dd,datediff(dd,0,getdate()),-7*26) and period >= DATEADD(dd,datediff(dd,0,getdate()),-7*52) then hours end) as Weeks26To52from YourTablegroup by clientId
But, that may not exactly be what you need for two reasons:1. Your week may not be defined as I explained above. You may be using ISO week for example.2. For those clients that report hours weekly, how do you make the decision whether to include the 26th week. If the report date is 26 weeks + 1 day ago, do you want to include it in the current half-year report, or the previous half-year report??