tags:

views:

62

answers:

0

Hello,

I have a MDX query that needs to agg some data but filter on leaf nodes.

I have a way to do it using DEPENDENTS and EXCEPT, but there can be 10's of thousands of leaf nodes, and filtering out is taking quite a bit of time

SELECT
  {
       [Measures].[Field1],
       [Measures].[Field2],
       [Measures].[Field3],
       [Measures].[Field4]
       }ON COLUMNS, 
       {[Dimension1].[Hierarchy].Category]} ON ROWS

FROM [MyCubeByCategory]
WHERE (
 EXCEPT({descendants([Dimension2].[Hierarchy].[Level 1(top parent) Name].&[SelectedParentKey].Children, [Dimension2].[Hierarchy].[Level 4 (leaf) Name])}, 
 {
 [Dimension2].[Hierarchy].[Leaf Name].&[SelectedLeafKey],
        [Dimension2].[Hierarchy].[Leaf Name].&[SelectedLeafKey],
        [Dimension2].[Hierarchy].[Leaf Name].&[SelectedLeafKey]})

To complicate things (perhaps this example describes it well enough, there are multiple levels to the hierarchy.. its not just parent child.. (in my current case there are 4 levels), and as you can see there are multiple sets of dimensions, which has kept my meager mind from figuring out how to use the Filter option without getting parsing errors.

Anyways, thoughts on making this more performent are greatly appreciated

Thanks