Durante lo sviluppo di un report per un cliente è sorta l'esigenza di estrarre i primi 10 articoli più venduti e, agglomerati in un'unica riga al fondo, tutti gli articoli rimanenti. Grazie a MDX è possibile effettuare molto facilmente questa analisi, ecco come, partendo dal cubo di AdventureWorks:
WITH
SET [TCat] AS TopCount([Product].[Subcategory].[Subcategory],10,[Measures].[Sales Amount])
MEMBER [Product].[Subcategory].[Other] AS
Aggregate([Product].[Subcategory].[Subcategory] - TCat)
SELECT { [Measures].[Sales Amount] } ON COLUMNS,
TCat + [Other] ON ROWS
FROM [Adventure Works];
e il risultato che si ottiene:
Fonte:
http://hccmsbi.blogspot.com/2006/08/top-10-plus-other-query.html