dbTalk Databases Forums  

Existing Statement

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


Discuss Existing Statement in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sd@dbconn
 
Posts: n/a

Default Existing Statement - 01-18-2006 , 08:31 AM






Hello,

I thought it is possible use the Exixting Statement in AS 2005 to calculate
a set in an othe context then te cube context. So for exampel:

[Dim Product].[Color].members=1;

scope([Dim Product].[Color].[Black]);
[Dim Product].[Color].[All]=sum(existing([Dim
Product].[Color].members));
end scope;

But after this skript the value of [Dim Product].[Color].[All] is eleven
and not as I expectet one.
Do I misunderstand the existing-statement or is a mistake in my skript?

thanks
stefan


Reply With Quote
  #2  
Old   
Chris Webb
 
Posts: n/a

Default RE: Existing Statement - 01-18-2006 , 10:59 AM






I think you've misunderstood what the EXISTING and SCOPE statements are meant
to do. Can you give me some idea of what you'd like to achieve?

Chris
--
Blog at:
http://spaces.msn.com/members/cwebbbi/


"sd@dbconn" wrote:

Quote:
Hello,

I thought it is possible use the Exixting Statement in AS 2005 to calculate
a set in an othe context then te cube context. So for exampel:

[Dim Product].[Color].members=1;

scope([Dim Product].[Color].[Black]);
[Dim Product].[Color].[All]=sum(existing([Dim
Product].[Color].members));
end scope;

But after this skript the value of [Dim Product].[Color].[All] is eleven
and not as I expectet one.
Do I misunderstand the existing-statement or is a mistake in my skript?

thanks
stefan


Reply With Quote
  #3  
Old   
sd@dbconn
 
Posts: n/a

Default RE: Existing Statement - 01-19-2006 , 05:29 AM



Hi Chris,

At the moment my main focus is to understand the EXISTING statement. In BOL
I found this:
By default, sets are evaluated within the context of the cube that contains
the members of the set. The Existing statement forces a set specified in
Set_Expression to be evaluated within the current context instead.

I thought the SCOPE statement produces a new context, in this Case ([Dim
Product].[Color].[Black]. Then the my hope was that the EXISTING forces the
SET [Dim Product].[Color].members to be evaluated in the subcube context. But
it fails.
So what is the use of the EXISTING statement, do you have an example?

stefan


"Chris Webb" wrote:

Quote:
I think you've misunderstood what the EXISTING and SCOPE statements are meant
to do. Can you give me some idea of what you'd like to achieve?

Chris
--
Blog at:
http://spaces.msn.com/members/cwebbbi/


"sd@dbconn" wrote:

Hello,

I thought it is possible use the Exixting Statement in AS 2005 to calculate
a set in an othe context then te cube context. So for exampel:

[Dim Product].[Color].members=1;

scope([Dim Product].[Color].[Black]);
[Dim Product].[Color].[All]=sum(existing([Dim
Product].[Color].members));
end scope;

But after this skript the value of [Dim Product].[Color].[All] is eleven
and not as I expectet one.
Do I misunderstand the existing-statement or is a mistake in my skript?

thanks
stefan


Reply With Quote
  #4  
Old   
Chris Webb
 
Posts: n/a

Default RE: Existing Statement - 01-19-2006 , 05:47 AM



Hi Stefan,

The context being referred to here is the query context, I think. Here's an
example query with Adventure Works:

WITH
MEMBER MEASURES.OCC AS GENERATE(EXISTING
[Customer].[Occupation].[Occupation].MEMBERS,
[Customer].[Occupation].CURRENTMEMBER.NAME, ",")
SELECT MEASURES.OCC ON 0,
[Customer].[Yearly Income].[Yearly Income].MEMBERS ON 1
FROM [ADVENTURE WORKS]

In this case you can see which occupations 'exist' with each member on the
yearly income hierarchy.

HTH,

Chris
--
Blog at:
http://spaces.msn.com/members/cwebbbi/


"sd@dbconn" wrote:

Quote:
Hi Chris,

At the moment my main focus is to understand the EXISTING statement. In BOL
I found this:
By default, sets are evaluated within the context of the cube that contains
the members of the set. The Existing statement forces a set specified in
Set_Expression to be evaluated within the current context instead.

I thought the SCOPE statement produces a new context, in this Case ([Dim
Product].[Color].[Black]. Then the my hope was that the EXISTING forces the
SET [Dim Product].[Color].members to be evaluated in the subcube context. But
it fails.
So what is the use of the EXISTING statement, do you have an example?

stefan


"Chris Webb" wrote:

I think you've misunderstood what the EXISTING and SCOPE statements are meant
to do. Can you give me some idea of what you'd like to achieve?

Chris
--
Blog at:
http://spaces.msn.com/members/cwebbbi/


"sd@dbconn" wrote:

Hello,

I thought it is possible use the Exixting Statement in AS 2005 to calculate
a set in an othe context then te cube context. So for exampel:

[Dim Product].[Color].members=1;

scope([Dim Product].[Color].[Black]);
[Dim Product].[Color].[All]=sum(existing([Dim
Product].[Color].members));
end scope;

But after this skript the value of [Dim Product].[Color].[All] is eleven
and not as I expectet one.
Do I misunderstand the existing-statement or is a mistake in my skript?

thanks
stefan


Reply With Quote
  #5  
Old   
sd@dbconn
 
Posts: n/a

Default RE: Existing Statement - 01-19-2006 , 06:40 AM



Thanks, this was the hint I was looking for.

"Chris Webb" wrote:

Quote:
Hi Stefan,

The context being referred to here is the query context, I think. Here's an
example query with Adventure Works:

WITH
MEMBER MEASURES.OCC AS GENERATE(EXISTING
[Customer].[Occupation].[Occupation].MEMBERS,
[Customer].[Occupation].CURRENTMEMBER.NAME, ",")
SELECT MEASURES.OCC ON 0,
[Customer].[Yearly Income].[Yearly Income].MEMBERS ON 1
FROM [ADVENTURE WORKS]

In this case you can see which occupations 'exist' with each member on the
yearly income hierarchy.

HTH,

Chris
--
Blog at:
http://spaces.msn.com/members/cwebbbi/


"sd@dbconn" wrote:

Hi Chris,

At the moment my main focus is to understand the EXISTING statement. In BOL
I found this:
By default, sets are evaluated within the context of the cube that contains
the members of the set. The Existing statement forces a set specified in
Set_Expression to be evaluated within the current context instead.

I thought the SCOPE statement produces a new context, in this Case ([Dim
Product].[Color].[Black]. Then the my hope was that the EXISTING forces the
SET [Dim Product].[Color].members to be evaluated in the subcube context. But
it fails.
So what is the use of the EXISTING statement, do you have an example?

stefan


"Chris Webb" wrote:

I think you've misunderstood what the EXISTING and SCOPE statements are meant
to do. Can you give me some idea of what you'd like to achieve?

Chris
--
Blog at:
http://spaces.msn.com/members/cwebbbi/


"sd@dbconn" wrote:

Hello,

I thought it is possible use the Exixting Statement in AS 2005 to calculate
a set in an othe context then te cube context. So for exampel:

[Dim Product].[Color].members=1;

scope([Dim Product].[Color].[Black]);
[Dim Product].[Color].[All]=sum(existing([Dim
Product].[Color].members));
end scope;

But after this skript the value of [Dim Product].[Color].[All] is eleven
and not as I expectet one.
Do I misunderstand the existing-statement or is a mistake in my skript?

thanks
stefan


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.