dbTalk Databases Forums  

limiting a set

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss limiting a set in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Clem
 
Posts: n/a

Default limiting a set - 04-14-2004 , 06:02 PM






Hi,

I have 2 dimensions, product and broker and a measure let's say
Profit.

I've created an mdx statement that will return the top 5 products and
then within that return the top 5 brokers within those top 5 products.

Here's the statement:

SELECT
{[Measures].[Profit]} ON COLUMNS,
GENERATE( TopCount( [Product].[Label].MEMBERS, 5,
[Measures].[Profit]), {Product.CurrentMember} * TopCount(
[Broker].[Agent Name].MEMBERS, 5, [Measures].[Profit]) ) )

ON ROWS
FROM [Sales]

This works, except that some products do not join with at least 5
brokers, so I'm getting only 2 or 3 top brokers within the products.
Is it possible to further filter the statement so that it ensures that
only products with at least 5 brokers are displayed?

Thanks in advance,
Clem

Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: limiting a set - 04-14-2004 , 08:23 PM






If you want to filter the initial Top 5 product set:

Quote:
SELECT
{[Measures].[Profit]} ON COLUMNS,
GENERATE(Filter(TopCount([Product].[Label].MEMBERS, 5,
[Measures].[Profit]),
NonEmptyCrossJoin([Broker].[Agent Name].MEMBERS,
{Product.CurrentMember}, 1).Count >= 5),
{Product.CurrentMember} * TopCount(
[Broker].[Agent Name].MEMBERS, 5, [Measures].[Profit]))

ON ROWS
FROM [Sales]
Quote:

- Deepak

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.