Why read the table twice?
SELECT
sumyy = sum(yy),
xx = ???('summary line') -- where ??? is an aggregate function
FROM tablea
CROSS APPLY (
SELECT SurrogateGroup = CASE
WHEN somedate_column < @startdate_parameter THEN <<constant value>>
WHEN somedate_column between @startdate_parameter and @enddate_parameter THEN <<tablea.PK>>
ELSE NULL end
) x
WHERE SurrogateGroup IS NOT NULL -- or use somedate_column <= @enddate_parameter
GROUP BY SurrogateGroup
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden