dbTalk Databases Forums  

Top 20 and some!!

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


Discuss Top 20 and some!! in the microsoft.public.sqlserver.olap forum.



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

Default Top 20 and some!! - 08-19-2005 , 09:52 AM






I have a query

SELECT
{[Measures].[MeasuresLevel].[Volume], [Measures].[MeasuresLevel].[PY
Volume]} ON 0,
TOPCOUNT(CROSSJOIN([Brand].[Brand Family].Members, [Global
Player].[Global Player].Members), 20,
[Measures].[MeasuresLevel].[Volume]) ON 1
FROM [Data]


Which works fine how ever I also want to add the top 5 Brand Familys
that only belong to a certain Global player. What is the extra bit of
code for this??

Also ther is a possiblility that the same brand family will appear in
both Top Statemnets so I wil only want the unique brand families?!

Is this possible if so Can anyone help

Thanks

Denver


Reply With Quote
  #2  
Old   
Jéjé
 
Posts: n/a

Default Re: Top 20 and some!! - 08-19-2005 , 08:12 PM






all of this is possible, but I have not all the answers...

first one, try start here:
http://groups.google.ca/group/micros...4bdf2fca4efbc0

which contain:
WITH
SET [Customers in USA] AS 'Descendants([Customers].[All Customers].[USA],
[Customers].[Name])'
SELECT {[Measures].[Profit]} ON COLUMNS,
Generate(TopCount({[Customers in USA]}, 10, [Measures].[Profit]),
CrossJoin({[Customers].Current*Member}, TopCount({[Product].[Product
Name].Members}, 5, [Measures].[Profit])), ALL) ON ROWS
FROM [Sales]


and here there are a lot of articles about mdx:
http://databasejournal.com/features/...0894_3508491_5

and maybe this article will answer your last question:
http://blogs.msdn.com/bi_systems/articles/162800.aspx


"Denver" <DenverKirrane (AT) gmail (DOT) com> wrote

Quote:
I have a query

SELECT
{[Measures].[MeasuresLevel].[Volume], [Measures].[MeasuresLevel].[PY
Volume]} ON 0,
TOPCOUNT(CROSSJOIN([Brand].[Brand Family].Members, [Global
Player].[Global Player].Members), 20,
[Measures].[MeasuresLevel].[Volume]) ON 1
FROM [Data]


Which works fine how ever I also want to add the top 5 Brand Familys
that only belong to a certain Global player. What is the extra bit of
code for this??

Also ther is a possiblility that the same brand family will appear in
both Top Statemnets so I wil only want the unique brand families?!

Is this possible if so Can anyone help

Thanks

Denver



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

Default Re: Top 20 and some!! - 08-20-2005 , 02:21 AM



How about using Union(), something like:

Quote:
SELECT
{[Measures].[MeasuresLevel].[Volume], [Measures].[MeasuresLevel].[PY
Volume]} ON 0,
Order(Union(
TOPCOUNT(CROSSJOIN([Brand].[Brand Family].Members, [Global
Player].[Global Player].Members), 20,
[Measures].[MeasuresLevel].[Volume]),
TOPCOUNT(CROSSJOIN([Brand].[Brand Family].Members, {[Global
Player].[Global Player].[Player X]}), 5,
[Measures].[MeasuresLevel].[Volume])),
[Measures].[MeasuresLevel].[Volume], BDESC) ON 1
FROM [Data]
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


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.