dbTalk Databases Forums  

MDX question

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


Discuss MDX question in the microsoft.public.sqlserver.olap forum.



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

Default MDX question - 04-08-2005 , 01:11 PM






I have a simple cube with a Store dimension with levels:

Region
State
City
Store

A single measure Sales.

Want MDX to see State on Rows and columns for:

Total Sales: Total sales for the State
Top Store: Name of the Store in the State with highest Sales

I can get the Sales column easy enough,
but how to get the name of the top store per State?

Thanks,

LMcPhee

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

Default Re: MDX question - 04-08-2005 , 06:27 PM






Here's an MDX query for the Foodmart Sales cube, which you can try in
the MDX Sample App:

Quote:
With Member [Measures].[TopStore] as
'TopCount(Descendants([Store].CurrentMember,
[Store].[Store Name]),
1, [Measures].[Unit Sales]).Item(0).Item(0).Name'

Select {[Measures].[Unit Sales],
[Measures].[TopStore]} on columns,
NonEmptyCrossJoin([Store].[Store State].Members) on rows
from Sales
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.