dbTalk Databases Forums  

Same level for more than one dimension

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


Discuss Same level for more than one dimension in the microsoft.public.sqlserver.olap forum.



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

Default Same level for more than one dimension - 12-01-2005 , 04:00 PM






I have two dimensions which have multiple levels. The bottom level for both
dimensions is "Item". These dimensions are used in an inventory cube. Now i
have to create a calculated measure which rolls up seperately if it is the
Item level or a higher level. do i need to check the level.name for each
dimension separately or can i do it with a single statement.

Anup

Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Same level for more than one dimension - 12-02-2005 , 11:44 PM






I don't believe there is any way to say something like "Do any of the
levels of the current context has a level called item?". You need to
test each dimension separately, but you can do it in one statement.
However the logic after that will need to be generic enough to handle
it. Otherwise you may need multiple nested iif statements.

Something like the following pseudo code should work:

IIF(dimension1.CurrentMember.Level.Name = "Item" OR
dimension2.CurrentMember.Level.Name = "Item"
, <true logic>
, <false logic>)

Since you need to specify the dimensions individually anyway, possibly a
better approach that would not rely on string matching and to do a
direct comparison against the level objects.

IIF(dimension1.CurrentMember.Level IS dimension1.Item OR
dimension2.CurrentMember.Level.Name IS dimension2.Item
, <true logic>
, <false logic>)

You can also test to see if a member is at the bottom level of a
hierarchy using the IsLeaf() function.

HTH

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <A75D9F12-F5A7-4CF1-85C5-1BFA63C64D5F (AT) microsoft (DOT) com>,
Anup (AT) discussions (DOT) microsoft.com says...
Quote:
I have two dimensions which have multiple levels. The bottom level for both
dimensions is "Item". These dimensions are used in an inventory cube. Now i
have to create a calculated measure which rolls up seperately if it is the
Item level or a higher level. do i need to check the level.name for each
dimension separately or can i do it with a single statement.

Anup


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

Default Re: Same level for more than one dimension - 12-03-2005 , 12:49 AM



thanks Darren, that sure helps.

"Darren Gosbell" wrote:

Quote:
I don't believe there is any way to say something like "Do any of the
levels of the current context has a level called item?". You need to
test each dimension separately, but you can do it in one statement.
However the logic after that will need to be generic enough to handle
it. Otherwise you may need multiple nested iif statements.

Something like the following pseudo code should work:

IIF(dimension1.CurrentMember.Level.Name = "Item" OR
dimension2.CurrentMember.Level.Name = "Item"
, <true logic
, <false logic>)

Since you need to specify the dimensions individually anyway, possibly a
better approach that would not rely on string matching and to do a
direct comparison against the level objects.

IIF(dimension1.CurrentMember.Level IS dimension1.Item OR
dimension2.CurrentMember.Level.Name IS dimension2.Item
, <true logic
, <false logic>)

You can also test to see if a member is at the bottom level of a
hierarchy using the IsLeaf() function.

HTH

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <A75D9F12-F5A7-4CF1-85C5-1BFA63C64D5F (AT) microsoft (DOT) com>,
Anup (AT) discussions (DOT) microsoft.com says...
I have two dimensions which have multiple levels. The bottom level for both
dimensions is "Item". These dimensions are used in an inventory cube. Now i
have to create a calculated measure which rolls up seperately if it is the
Item level or a higher level. do i need to check the level.name for each
dimension separately or can i do it with a single statement.

Anup



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.