I managed to do it with the following code:
with Order_rows(org_id, row_num)
as (
select accum_amt, row_number() over(order by org_id)
from prst.nvt_org
order by org_id)
,
trim
As (
Select org_id, row_num
from Order_rows
where row_num < 101 )
Select sum(case when row_num <...