I have a table with 4 columns. Namely accit qtyd qtyr run total I have tried this so far SUM(qtyd-qtdr)FILTER (WHERE t1.accit = t1min.accit)OVER (ORDER BY t1.accit ROWS UNBOUNDED PRECEDING)AS RUNtotal The problem is that it is doing a running total but for all. I need it to do per accit and then the next accit 1. 5. 2. 3 1. 2. 1. 4 2. 5. 1 8 ( here it should be 4 as it is a new accit) Please help as to where I am going wrong.