Let's say I have a table with orders with revenue and status columns. I want to group the orders by revenue group (grouped by increments of 10) and get the percentage of which have their status column set to 1 in their respective revenue group. I thought a window function was the way to go, but the where statement restricts the columns so that I end up with only the columns where status == 1. The end result would look something like: Let's say I have a table with orders with reven