SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Exculde members from existing Set using MDX Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ravuri.vasu
Starting Member

2 Posts

Posted - 02/20/2013 :  04:22:50  Show Profile  Reply with Quote
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.

Edited by - ravuri.vasu on 02/20/2013 05:04:34

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 02/20/2013 :  04:27:45  Show Profile  Reply with Quote
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 - 02/20/2013 :  04:53:39  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000