Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Exculde members from existing Set using MDX Query

Author  Topic 

ravuri.vasu
Starting Member

2 Posts

Posted - 2013-02-20 : 04:22:50
Hello All,

I need an MDX to eliminate some of the members in existing set, my scenario is as below

I have dimension which has n-level parent child hierarchy and I am using that dimension in PPS dashboard. When user selects all children along with the parent then I should not display children and i should only display parent and this is applicable for any level.

Below is the example, assuming that Company is my dimension and it has HR and Finance departments and sub-departments under the main departments (I added primary key of each dept in Parenthesis)

Company (1)
---------- HR (2)
---------------- HR Sub 1 (3)
---------------- HR Sub 2 (4)
---------- Finance (5)
---------------- Finance Sub 1 (6)
---------------- Finance Sub 2 (7)

I am using the above dimension as "Multi Select Tree" in my PPS so user can select HR, HR Sub 1, HR Sub 2 at a time. When selects all child under parent then I need to exclude the children.

Below is the logic to achieve it

First get parent for each member and if the member parent is exists in the selected set then ignore that member. To achieve this I wrote a MDX and I am able to find the Parent of each member but I don’t know how to check whether the parent exists in the set or not.

below is the MDX I wrote

WITH SET DeptSet AS '{[Company].[Dept].&[2], [Company].[Dept].&[3],[Company].[Dept].&[4], [Company].[Dept].&[6]}'
MEMBER Measures.ParentNode as [Company].[Dept].CURRENTMEMBER.PARENT.UNIQUENAME
SELECT [Measures].[EmpCount] on ROWS,
{Need Trimmed Member Set Here} on COLUMNS
FROM [CUBE]

In the above MDX "DeptSet" is the set which I receive from PPS and after implementing the above logic I need to get the set as below

{[Company].[Dept].&[2], [Company].[Dept].&[6]}

Thanks in advance.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-20 : 04:27:45
do you mean you've different level members existing in the same set? are them part of hierarchy defined in cube?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ravuri.vasu
Starting Member

2 Posts

Posted - 2013-02-20 : 04:53:39
quote:
Originally posted by visakh16

do you mean you've different level members existing in the same set? are them part of hierarchy defined in cube?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Yes different level members are passed in same set, in my example the set consists of below items
1. HR
2. HR Sub 1
3. HR Sub 2
4. Finance Sub 1


Go to Top of Page
   

- Advertisement -