dbTalk Databases Forums  

MDX query to count parent with out childs

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


Discuss MDX query to count parent with out childs in the microsoft.public.sqlserver.olap forum.



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

Default MDX query to count parent with out childs - 11-19-2003 , 04:36 AM






Using a parent-child table looking as below

ID (not a primarykey
ParentID referencing the I
OtherID a foriegnke

I would like to have two measures

1. A aggregated count of OtherID's for the parent and all it child's ( This is provided by using MSAS inbuild measure count
2. A count on just the parent with out its childs.

How can I define the second measure

Regard

Marti


Reply With Quote
  #2  
Old   
Andrej Hudoklin
 
Posts: n/a

Default Re: MDX query to count parent with out childs - 11-19-2003 , 06:48 AM






Hi Martin,

as I understand the first measure you already have.

And if you want to see only for the parent you can do this to set property
"Members with data" to Non-leaf data visible, on this parent-child
dimension. This will show you only parent data, but a level lower -> in
dimension there will appear a new member among the children of the selected
parent. You can name it like * data... -> this is the next property you can
set as you like.
This is one solution.

Other could be to make a new calculated measure
as:
[Measure].[countOtherIDs] - sum(descendants( [Dimension].currentmember, 1),
[Measures].[countOtherIDs])




"Martin" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Using a parent-child table looking as belows

ID (not a primarykey)
ParentID referencing the ID
OtherID a foriegnkey

I would like to have two measures:

1. A aggregated count of OtherID's for the parent and all it child's (
This is provided by using MSAS inbuild measure count )
2. A count on just the parent with out its childs.

How can I define the second measure?

Regards

Martin




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.