以下のコードでは、アクティブな年齢の代わりに、Open_time と現在の時刻を使用して計算を行う必要があります。
つまり、現在の時刻から open_time を差し引いた値が 0 から 30 の間、または 31 から 60 の間、または 60 を超える場合に行う必要があります。
SELECT COUNT(CASE WHEN Assignment = 'Crosby' AND Severity = 4 AND CloseTime-OpenTime = 0-30 THEN P_NUMBER END) as crosby_sev4_030,
COUNT(CASE WHEN Assignment = 'Crosby' AND Severity = 5 AND Active_Age='0-30' THEN P_NUMBER END) as crosby_sev5_030,
COUNT(CASE WHEN Assignment = 'Crosby' AND Severity = 4 AND Active_Age='31-60' THEN P_NUMBER END) as crosby_sev4_3160,
COUNT(CASE WHEN Assignment = 'Crosby' AND Severity = 5 AND Active_Age='31-60' THEN P_NUMBER END) as crosby_sev5_3160,
COUNT(CASE WHEN Assignment = 'Crosby' AND Severity = 4 AND Active_Age='60+' THEN P_NUMBER END) as crosby_sev4_60,
COUNT(CASE WHEN Assignment = 'Crosby' AND Severity = 5 AND Active_Age='60+' THEN P_NUMBER END) as crosby_sev5_60
FROM dashboard.dbo.SmThings
WHERE Assignment IN('Crosby')
AND Severity IN(4,5)