Basically what you have to do is to
- Solution 1: Calculate whole weeks from '2012-09-10' and then add it to '2012-09-10'
- Solution 2: Calculate remainder when calculating whole weeks from '2012-09-10' and then substract it from salesdate:
-
select
emp, salesdate, sales, prevperiod, item,
dateadd(day, -datediff(day, '20120910', salesdate) % 14, salesdate) as salesdateperiodstart1,
dateadd(day, (datediff(day, '20120910', salesdate) / 14) * 14, '20120910') as salesdateperiodstart2
from Table1