Below is the solution and answer is inspired from
Dieter Answer from the link below
https://forums.teradata.com/forum/database/olap-function-csum-sum-with-reset-value
select cal_date,
holiday_flag,
sum(holiday_flag) over(order by cal_date RESET WHEN holiday_flag = 0 rows unbounded preceding )
as count_num from dim_date
Below is the solution and answer is inspired from
Dieter Answer from the link below
https://forums.teradata.com/forum/database/olap-function-csum-sum-with-reset-value
select cal_date,
holiday_flag,
sum(holiday_flag) over(order by cal_date RESET WHEN holiday_flag = 0 rows unbounded preceding )
as count_num from dim_date