Postgresql Window Function Count Excel