MDX Trick: Top 10 Plus Other Query

Here is – essentially for my own future reference – a trick that Reed Jacobson posted a while ago. I didn’t use it yet but this will come in handy at some point.

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]
;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s