Utilisez les fonctions de fenêtrage :
http://sqlpro.developpez.com/article/olap-clause-window/

A +