• this is what i got.

    not sure how to pivot the info to how you want it though, as the weekCommencing is not known from the start.

    SELECT DISTINCT

    --[WeekNumber],

    COUNT(weekNumber) OVER (PARTITION BY [WeekNumber]) AS CountWeekNum ,

    WeekCommencing = DATEADD(DAY,((DATEPART(w,[y].ApptDt2))-1)* -1,[y].ApptDt2)

    FROM (

    SELECT

    WeekNumber = DATEPART(week,[v].[ApptDt2]) ,

    [v].[ApptDt2]

    FROM visits [v]

    )y

    ORDER BY WeekCommencing