Just wrap it in a subselect. SELECT * FROM ( SELECT id, date, amount, SUM(amount) OVER (ORDER BY date) AS balance FROM entries GROUP BY id, date, amount ) WHERE date >= '2017-12-03' ORDER BY date; I'm also confused about a few things if you have three rows you don't have to group by it, see if this gives you the same result, it should be a lot faster. SELECT * FROM ( SELECT id, date, amount, SUM(amount) OVER (ORDER BY id) AS balance FROM entries ) WHERE date >= '2017-12-03' ORDER BY id;