I think you can do that with the over() function and count(). Let me check the docs....