dbTalk Databases Forums  

deviding roll up value by number of descendants

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


Discuss deviding roll up value by number of descendants in the microsoft.public.sqlserver.olap forum.



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

Default deviding roll up value by number of descendants - 12-17-2004 , 03:55 AM






Hi,

i have a calculated member:

[Measures].[Available]/Count({descendants([Unit].Currentmember,[Unit].[Unit
Name])})

This one devides the value 'Available' by the number of Units. Example:
[Measures].[Available]
UnitA 4
UnitB 4
UnitC
UnitD 4

On roll up on 'All Units' this formulas returns the value 3. In the division
UnitC is also counted for the division even when it's empty. Now i am trying
to look for one of the built in function to filter this empty Unit, so that
the result will be 4 instead of 3. However i can't find the non empty
function within the MDX sample application. Is there a way to filter this
empty Unit?

Thnx,

Stanley

Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: deviding roll up value by number of descendants - 12-18-2004 , 02:49 PM






One way is to use Filter() with IsEmpty():

Quote:
[Measures].[Available]/Count(Filter(
Descendants([Unit].Currentmember,
[Unit].[Unit Name]),
NOT IsEmpty([Measures].[Available])))
Quote:

- Deepak

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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

Default Re: deviding roll up value by number of descendants - 12-20-2004 , 03:49 AM



Thnx Deepak,

It worked.

- Stanley

"Deepak Puri" wrote:

Quote:
One way is to use Filter() with IsEmpty():


[Measures].[Available]/Count(Filter(
Descendants([Unit].Currentmember,
[Unit].[Unit Name]),
NOT IsEmpty([Measures].[Available])))



- Deepak

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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.