dbTalk Databases Forums  

MDX: Crossjoin and Topcount

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


Discuss MDX: Crossjoin and Topcount in the microsoft.public.sqlserver.olap forum.



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

Default MDX: Crossjoin and Topcount - 04-16-2004 , 01:25 PM






I'm trying to get a "top 10 products by revenue, by state" kind of mdx, but
the topcount doesn't seem to be run in the context of the current state, the
products come back in the same order for each state in the crossjoin. Any
ideas?

Right now I have something allong the lines of

WITH SET [Top 10 Products] AS
'TopCount([Product].MEMBERS,10,[Sales])'

SELECT {Measures.Sales} ON COLUMNS,
Crossjoin([Geography].[State].Members,[Top 10 Products]) ON ROWS
FROM [Sales Cube]

Thanks in advance again!

Derrick



Reply With Quote
  #2  
Old   
Tom Chester
 
Posts: n/a

Default Re: Crossjoin and Topcount - 04-16-2004 , 01:33 PM






Named sets do not resolve in query context. If you do the TopN inline it
will behave as expected.

public @ the domain below
www.tomchester.net

"Derrick" <derrick1298 (AT) excite (DOT) com> wrote

Quote:
I'm trying to get a "top 10 products by revenue, by state" kind of mdx,
but
the topcount doesn't seem to be run in the context of the current state,
the
products come back in the same order for each state in the crossjoin. Any
ideas?

Right now I have something allong the lines of

WITH SET [Top 10 Products] AS
'TopCount([Product].MEMBERS,10,[Sales])'

SELECT {Measures.Sales} ON COLUMNS,
Crossjoin([Geography].[State].Members,[Top 10 Products]) ON ROWS
FROM [Sales Cube]

Thanks in advance again!

Derrick






Reply With Quote
  #3  
Old   
Derrick
 
Posts: n/a

Default Re: Crossjoin and Topcount - 04-16-2004 , 01:36 PM



Tom,

Thanks, don't see TopN in the SQL doc? Do you have a link to an example?

Thanks again!

Derrick

"Tom Chester" <nospam_public (AT) tomchester (DOT) net> wrote

Quote:
Named sets do not resolve in query context. If you do the TopN inline it
will behave as expected.

public @ the domain below
www.tomchester.net

"Derrick" <derrick1298 (AT) excite (DOT) com> wrote in message
news:upC73A%23IEHA.2556 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
I'm trying to get a "top 10 products by revenue, by state" kind of mdx,
but
the topcount doesn't seem to be run in the context of the current state,
the
products come back in the same order for each state in the crossjoin.
Any
ideas?

Right now I have something allong the lines of

WITH SET [Top 10 Products] AS
'TopCount([Product].MEMBERS,10,[Sales])'

SELECT {Measures.Sales} ON COLUMNS,
Crossjoin([Geography].[State].Members,[Top 10 Products]) ON ROWS
FROM [Sales Cube]

Thanks in advance again!

Derrick








Reply With Quote
  #4  
Old   
Tom Chester
 
Posts: n/a

Default Re: Crossjoin and Topcount - 04-17-2004 , 10:00 AM



Sorry, by TopN I meant TopCount (plus various Top*, Bottom* functions).

--
public @ the domain below
www.tomchester.net
"Derrick" <derrick1298 (AT) excite (DOT) com> wrote

Quote:
Tom,

Thanks, don't see TopN in the SQL doc? Do you have a link to an example?

Thanks again!

Derrick

"Tom Chester" <nospam_public (AT) tomchester (DOT) net> wrote in message
news:tEVfc.288$_R.46073 (AT) news (DOT) uswest.net...
Named sets do not resolve in query context. If you do the TopN inline it
will behave as expected.

public @ the domain below
www.tomchester.net

"Derrick" <derrick1298 (AT) excite (DOT) com> wrote in message
news:upC73A%23IEHA.2556 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
I'm trying to get a "top 10 products by revenue, by state" kind of
mdx,
but
the topcount doesn't seem to be run in the context of the current
state,
the
products come back in the same order for each state in the crossjoin.
Any
ideas?

Right now I have something allong the lines of

WITH SET [Top 10 Products] AS
'TopCount([Product].MEMBERS,10,[Sales])'

SELECT {Measures.Sales} ON COLUMNS,
Crossjoin([Geography].[State].Members,[Top 10 Products]) ON ROWS
FROM [Sales Cube]

Thanks in advance again!

Derrick










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.