dbTalk Databases Forums  

TopCount ignores the axis clause

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


Discuss TopCount ignores the axis clause in the microsoft.public.sqlserver.olap forum.



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

Default TopCount ignores the axis clause - 05-10-2004 , 11:04 PM






Hi all,

I am trying to use TopCount to display the top 20 selling products during
Q1, 1997. I have noticed that TopCount works as intended if I put
[Time].[1997].[Q1] in the slicer, but not if it is in one of the axis
clauses. Is this intended behaviour?

Eg, the query below actually lists the top-selling items for [Time].[1997].

I want to use the time dimension on the columns axis, so I can't put the
correct time member into the slicer. Is there any workaround for this
problem?

Thanks,

Peter

select
non empty
{[Time].[1997].[Q1]}
on columns,
non empty
{TopCount(Descendants([Product].levels(0).members, [Product].[Product
Name]), 20, [Measures].[Unit Sales])}
on rows
from [Sales] where
([Measures].[Unit Sales])



Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default RE: TopCount ignores the axis clause - 05-11-2004 , 07:26 AM






Try replacing

[Measures].[Unit Sales] in the Rows expression, by

([Measures].[Unit Sales] ,[Time].[1997].[Q1]

That should work
HTH
Brian
www.geocities.com/brianaltmann/olap.htm



Reply With Quote
  #3  
Old   
Peter Kenyon
 
Posts: n/a

Default Re: TopCount ignores the axis clause - 05-12-2004 , 08:21 PM




"Brian Altmann" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Try replacing

[Measures].[Unit Sales] in the Rows expression, by:

([Measures].[Unit Sales] ,[Time].[1997].[Q1])

That should work.
HTH,
Brian
www.geocities.com/brianaltmann/olap.html

I still get exactly the same result, and it is obvious that it is not the
right one because the products aren't sorted by unit sales in the cellset.
Is there anything else I can try?

Thanks,

Peter




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

Default Re: TopCount ignores the axis clause - 05-12-2004 , 09:07 PM



I just tried Brian's suggestion and it worked for me
- the Unit Sales did get listed in descending order.
Here's the modified MDX query that I used:

Quote:
select
non empty
{[Time].[1997].[Q1]}
on columns,
non empty
{TopCount(Descendants([Product].levels(0).members,
[Product].[Product Name]),
20, ([Measures].[Unit Sales], [Time].[1997].[Q1]))}
on rows
from [Sales] where
([Measures].[Unit Sales])

Quote:
- Deepak

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


Reply With Quote
  #5  
Old   
Peter Kenyon
 
Posts: n/a

Default Re: TopCount ignores the axis clause - 05-13-2004 , 04:25 AM




"Deepak Puri" <deepak_puri (AT) progressive (DOT) com> wrote

Quote:
I just tried Brian's suggestion and it worked for me
- the Unit Sales did get listed in descending order.
Here's the modified MDX query that I used:


select
non empty
{[Time].[1997].[Q1]}
on columns,
non empty
{TopCount(Descendants([Product].levels(0).members,
[Product].[Product Name]),
20, ([Measures].[Unit Sales], [Time].[1997].[Q1]))}
on rows
from [Sales] where
([Measures].[Unit Sales])

Thank you. My bad, I was changing the column clause and not the row clause.
It works now.

Peter




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.