dbTalk Databases Forums  

Crossjoin and TopCount, take 2

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


Discuss Crossjoin and TopCount, take 2 in the microsoft.public.sqlserver.olap forum.



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

Default Crossjoin and TopCount, take 2 - 04-16-2004 , 02:01 PM






If I write the query like so, this works on foodmart sales cube

SELECT
{[Measures].[Store Sales]} ON COLUMNS,
CrossJoin(
Gender.Gender.Members,
Topcount([Product].[Product Department].Members,5,[Measures].[Store
Sales])) ON ROWS
FROM [SALES]

I get:
F Produce
...
Canned Foods

M Produce
...
Canned Foods

But, Baked Goods is really number 5 for females (If I did the query without
the join and just put gender.F as a slicer spec you can see this)

I know I saw this example somewhere a while ago, need to get the topcount to
resolve for the current Gender member on each pass thru the crossjoin.

Any ideas?

Thanks again!

Derrick





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

Default Re: Crossjoin and TopCount, take 2 - 04-16-2004 , 02:27 PM






Never mind, found it...

SELECT
{[Measures].[Store Sales]} ON COLUMNS,
Generate(
[Gender].[Gender].Members,
{[Gender].CurrentMember} * Topcount([Product].[Product
Department].Members,5,[Measures].[Store Sales])) ON ROWS
FROM [SALES]



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

Quote:
If I write the query like so, this works on foodmart sales cube

SELECT
{[Measures].[Store Sales]} ON COLUMNS,
CrossJoin(
Gender.Gender.Members,
Topcount([Product].[Product Department].Members,5,[Measures].[Store
Sales])) ON ROWS
FROM [SALES]

I get:
F Produce
...
Canned Foods

M Produce
...
Canned Foods

But, Baked Goods is really number 5 for females (If I did the query
without
the join and just put gender.F as a slicer spec you can see this)

I know I saw this example somewhere a while ago, need to get the topcount
to
resolve for the current Gender member on each pass thru the crossjoin.

Any ideas?

Thanks 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.