dbTalk Databases Forums  

Top member of a level?

comp.databases.olap comp.databases.olap


Discuss Top member of a level? in the comp.databases.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
chrisn@nildram.co.uk
 
Posts: n/a

Default Top member of a level? - 05-19-2005 , 06:05 AM






I am trying to get the top member of a particular level, for each
member of another dimension.

Translating this into FoodMart2000, using the sales cube, I want to get
the top selling product for each US state.

I can get the information using this query...

WITH
MEMBER [Measures].[TopProductName] as
'SetToStr(Head(Order(Filter(Descendants([product].[all products],
[product name]), [measures].[unit sales] <> 0), [measures].[unit
sales], DESC)))'
SELECT
{Descendants([Customers].[all customers].[usa], [state province])} on
rows,
{ [Measures].[TopProductName]} on columns
FROM Sales

The problem is that performance is slow (not in foodmart, but in my own
cube), and instead of just getting the product name I am getting the
complete UniqueName, complete with braces and everything. I can strip
these out in code, but I'd prefer not to have to.

I am able to get the sales amount using...

MEMBER [Product].[TopProduct] as
'Order(Filter(Descendants([product].[all products], [product name]),
[measures].[unit sales] <> 0), [measures].[unit sales], DESC).Item(0) '
MEMBER [Measures].[TopProductSales] as '([Measures].[Unit Sales],
[Product].[TopProduct])'

This works fine and performance is great when I put
[Product].[TopProduct] into the cube.

Is there a way to use the [Product].[TopProduct] member to get the name
of the top member?

Thanks,
Chris N


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.