Group by every N records but remove incomplete group that has records less than N
WITH T AS 
(
  SELECT 
    RANK() OVER (ORDER BY dateReceived ) Rank,
    p.data
  FROM parameterData p where parameterID=@parameterID
    and dateReceived between @fromDate and @toDate
    and recipe = @recipe
    and isActive=1
)
SELECT 
  ROW_NUMBER() OVER (ORDER BY (SELECT 100)) AS GroupID, 
  (Rank - 1) / @groupSize as GroupSize, 
  AVG(data) as average, 
  MIN(data) as min,
  MAX(data) as max,
  MAX(data)-MIN(data) as range, 
  count(*) as cnt
FROM T
GROUP BY ((Rank - 1) / @groupSize)
HAVING count(*) = 5;