dbTalk Databases Forums  

TopCount with Generate help

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


Discuss TopCount with Generate help in the microsoft.public.sqlserver.olap forum.



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

Default TopCount with Generate help - 08-03-2004 , 04:19 PM






I have a query almost working

SELECT
{ [Measures].[Sends] }
on axis(0),
Generate (
TopCount ([Zone Id].[Zone Id].Members,5, [Sends]),
TopCount (Descendants({[Zone Id].CurrentMember}, 3),5,[Sends] )

) on axis (1)
FROM [Consumer]
--------------------------------------------------
This is the data and levels of Ids. I need the top 5 Level1 Id's. And for
each Level1 Id, I need the top 5 Level3 Id's.

[Zone Id]->[Zone Id]->[Level1 Id]->[Level2 Id]->[Level3 Id]


Right now I get the right data, but it sorts it according to the 'Zone Id'
Giving me the top 5 Level3 Id's for Zone Id.
I need 'Zone Id' to always be '14'.

I tried to add
FROM [Consumer] where [Zone Id].[14]

but that didn't work.

And I'm having problems going:
TopCount ([Zone Id].[14].Members,5, [Sends]),
TopCount ([Zone Id].[14].[Partner Id].Members,5, [Sends]),
I get the name binding errors




Reply With Quote
  #2  
Old   
Cindy Lee
 
Posts: n/a

Default Re: TopCount with Generate help - 08-03-2004 , 04:31 PM






And if I do this: I can't get the CurrentMember to be 'Level1 Id', I just
get back 5 results cus the current member is always 14.

SELECT
{ [Measures].[Sends] }
on axis(0),
Generate (
TopCount ({[Zone Id].[14]},5, [Sends]),
TopCount ( Descendants({[Zone Id].CurrentMember}, 3),5,[Sends] )

) on axis (1)
FROM [Consumer]


"Cindy Lee" <cindylee (AT) hotmail (DOT) com> wrote

Quote:
I have a query almost working

SELECT
{ [Measures].[Sends] }
on axis(0),
Generate (
TopCount ([Zone Id].[Zone Id].Members,5, [Sends]),
TopCount (Descendants({[Zone Id].CurrentMember}, 3),5,[Sends] )

) on axis (1)
FROM [Consumer]
--------------------------------------------------
This is the data and levels of Ids. I need the top 5 Level1 Id's. And
for
each Level1 Id, I need the top 5 Level3 Id's.

[Zone Id]->[Zone Id]->[Level1 Id]->[Level2 Id]->[Level3 Id]


Right now I get the right data, but it sorts it according to the 'Zone Id'
Giving me the top 5 Level3 Id's for Zone Id.
I need 'Zone Id' to always be '14'.

I tried to add
FROM [Consumer] where [Zone Id].[14]

but that didn't work.

And I'm having problems going:
TopCount ([Zone Id].[14].Members,5, [Sends]),
TopCount ([Zone Id].[14].[Partner Id].Members,5, [Sends]),
I get the name binding errors






Reply With Quote
  #3  
Old   
Cindy Lee
 
Posts: n/a

Default Re: TopCount with Generate help - 08-03-2004 , 06:05 PM



Ok, this worked ok, i the CurrentMember, 2), 2 instead of 3

SELECT
{ [Measures].[Sends],[Measures].[CampaignName] }
on axis(0),
Generate (
TopCount ( [Zone Id].[14].children, 5, [Sends]),
TopCount (Descendants([Zone Id].CurrentMember, 2),5,[Sends] )

) on axis (1)
FROM [Consumers]


"Cindy Lee" <cindylee (AT) hotmail (DOT) com> wrote

Quote:
And if I do this: I can't get the CurrentMember to be 'Level1 Id', I just
get back 5 results cus the current member is always 14.

SELECT
{ [Measures].[Sends] }
on axis(0),
Generate (
TopCount ({[Zone Id].[14]},5, [Sends]),
TopCount ( Descendants({[Zone Id].CurrentMember}, 3),5,[Sends] )

) on axis (1)
FROM [Consumer]


"Cindy Lee" <cindylee (AT) hotmail (DOT) com> wrote in message
news:eCE8g%23ZeEHA.1656 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
I have a query almost working

SELECT
{ [Measures].[Sends] }
on axis(0),
Generate (
TopCount ([Zone Id].[Zone Id].Members,5, [Sends]),
TopCount (Descendants({[Zone Id].CurrentMember}, 3),5,[Sends] )

) on axis (1)
FROM [Consumer]
--------------------------------------------------
This is the data and levels of Ids. I need the top 5 Level1 Id's. And
for
each Level1 Id, I need the top 5 Level3 Id's.

[Zone Id]->[Zone Id]->[Level1 Id]->[Level2 Id]->[Level3 Id]


Right now I get the right data, but it sorts it according to the 'Zone
Id'
Giving me the top 5 Level3 Id's for Zone Id.
I need 'Zone Id' to always be '14'.

I tried to add
FROM [Consumer] where [Zone Id].[14]

but that didn't work.

And I'm having problems going:
TopCount ([Zone Id].[14].Members,5, [Sends]),
TopCount ([Zone Id].[14].[Partner Id].Members,5, [Sends]),
I get the name binding errors








Reply With Quote
  #4  
Old   
Harsh
 
Posts: n/a

Default Re: TopCount with Generate help - 08-03-2004 , 10:11 PM



why not just change [Zone Id].[14] to [Zone Id].[14].MEMBERS...
================================================== ==============

SELECT
{ [Measures].[Sends] }
on axis(0),
Generate (
TopCount ({[Zone Id].[14].MEMBERS},5, [Sends]),
TopCount ( Descendants({[Zone Id].CurrentMember}, 3),5,[Sends] )

) on axis (1)
FROM [Consumer]


I guess......that's what you are asking.....

Reply With Quote
  #5  
Old   
Cindy Lee
 
Posts: n/a

Default Re: TopCount with Generate help - 08-04-2004 , 11:48 AM



I get a cannont bind error if I do that.
It's ok now though.
"Harsh" <creative (AT) mailcity (DOT) com> wrote

Quote:
why not just change [Zone Id].[14] to [Zone Id].[14].MEMBERS...
================================================== ==============

SELECT
{ [Measures].[Sends] }
on axis(0),
Generate (
TopCount ({[Zone Id].[14].MEMBERS},5, [Sends]),
TopCount ( Descendants({[Zone Id].CurrentMember}, 3),5,[Sends] )

) on axis (1)
FROM [Consumer]


I guess......that's what you are asking.....



Reply With Quote
  #6  
Old   
Harsh
 
Posts: n/a

Default Re: TopCount with Generate help - 08-04-2004 , 10:41 PM



My mistake...

[Zone Id].[14].children

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.