Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

MDX to return the value of children for a specific type of parent

$
0
0

Hi,

I need to create an MDX query to return the value of a measure associated to the children of a specific parent type.

In My cube I´ve a dimension with a Parent-Child hierachy and with a Type attribute hierachy, ex:

DimProduct

   > Products (parent-child Hierachy)

   > Type (attribute Hierarchy)

Let's say that the source table used to load the DimProduct is:

ProductID ParentID Value Type
1  100 A
2  200 B
3 1 30 C
4 2 10 C
5 2 5 C
6 1 20 C
7 1 15 C
8 2 20 C
9 1 5 C

Imagine that I want to know the sum of the value of the children that have a type B parent, i.e., the MDX should return:

sum (Value of children of parent of type B) = 10+5+20 = 35

To finish my requirement is also to return the remaining value, i.e., the final MDX query should return:

sum (Value of children of parent of type B) = 10+5+20 = 35

Remaining Value of Parent Type B = 200 - 35 = 165

Thanks in advance, Luis


Viewing all articles
Browse latest Browse all 2472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>