Count number of children of my dimension

Hello,

Here is my code

WITH MEMBER [Measures].[Direct Reporting] AS [Employee].[Employees].CurrentMember.Children.Count MEMBER [Measures].[Indirect Reporting] AS DESCENDANTS([Axe_ORGANISATION].[Collaborateurs].[PLATEAU], 2, AFTER).Count SELECT { [Measures].[Direct Reporting], [Measures].[Indirect Reporting] } ON COLUMNS, { [Axe_ORGANISATION].[Collaborateurs].[PLATEAU].MEMBERS } ON ROWS FROM [PVC_Reporting] Direct Reporting Indirect Reporting
 

The problem is that the first measure gives me error and the second gives me the count of all values and does not give me the total by each dimension.

Any idea

November 14th, 2013 5:08am

Hi Zizou,

The easiest way to count parent/child dimension members would be using COUNT and then DESCENDANTS function. Here is samplce MDX I would use on Adventure works database:

WITH MEMBER [Measures].[ACount1] AS 
[Employee].[Employees].CurrentMember.Children.Count 
MEMBER [Measures].[ACount] AS 
 COUNT(DESCENDANTS([Employee].[Employees].CurrentMember,, AFTER))
 SELECT {[Measures].[ACount],[Measures].[ACount1]} ON 0
 , {[Employee].[Employees].&[112].Children} ON 1
 FROM [Adventure Works]

Here is the results.

However, in your scenario Direct Reporting is used to count Employee dimension, Indirect Reporting is used to count Axe_ORGANISATION dimension, so when you select Axe_ORGANISATION dimension on row level, so the first count display #ERROR.

Regards,

Free Windows Admin Tool Kit Click here and download it now
November 19th, 2013 4:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics