Для таких примеров данных:
select * into #tab from (
select 1 as NILH1, 2 as NILH2, cast('2019-03-17 18:00' as datetime) as DateStamp
union all select 2, 3, cast('2019-03-17 18:00' as datetime)
union all select 3, 4, cast('2019-03-17 18:00' as datetime)
union all select 4, 5, cast('2019-06-17 18:00' as datetime)
union all select 28, 29, cast('2019-03-17 18:00' as datetime)
) data
select * from #tab
-- NILH1 NILH2 DateStamp
-- --------------------------------------
-- 1 2 2019-03-17 18:00:00.000
-- 2 3 2019-03-17 18:00:00.000
-- 3 44 2019-03-17 18:00:00.000
-- 4 5 2019-06-17 18:00:00.000 <-- invalid timestamp
-- 28 6 2019-03-17 18:00:00.000
Вы можете использовать CTE:
;with SUMS as
(
SELECT
SUM(CASE WHEN NILH1 <= 25 THEN NILH1 ELSE 0 END) as NILH1SUM,
SUM(CASE WHEN NILH2 <= 25 THEN NILH2 ELSE 0 END) as NILH2SUM
FROM #tab
WHERE DateStamp BETWEEN '2019-03-17 08:00' AND '2019-04-17 08:00'
)
select
NILH1SUM as NILH1SUM,
NILH2SUM as NILH2SUM,
NILH1SUM + NILH2SUM as TOTAL
from
SUMS
-- NILH1SUM NILH2SUM TOTAL
-- -----------------------
-- 6 11 17