Link to home
Start Free TrialLog in
Avatar of GhostRider10
GhostRider10

asked on

MDX LEAF Memeber Count

I have put together a cube to analyse sales to certain hotels in MS Analysis Services (I didn't see a group for it under databases and thought ERP was closest). These hotels roll up into countries and then sales regions. One of the accounts in the cube is sales cycle days. This is the amount of days between 'Contact made date' and 'Contract signed Date'. This is great except that when the hotel dimension is showing countries or sales regions, the account just rolls up all of is decesndants values. What I am wanting to achieve is an average sales cycle account. What I have though of doing is keeping the 'sales cycle days' account, but adding a hotel count account and an AVG_SALES_CYLCE account. The AVG_SALES_CYCLE would be a calculated member ('Sales cycle days/hotel count').
  The question is ... how do I create the 'hotel count', curently I have
IiF([HOTEL].currentmember.children.count=0, 1, [hotel].currentmember.children.count) . This works ok but is obviously just counting the immediate children, What i need is a count of all the leaf level descendants i.e. hotels. I have tried the DESCENDANTS funciton with LEAVES parameter, but can't seem to get that to work - IiF([HOTEL].currentmember.children.count=0, 1, decendants([hotel].currentmember,LEAVES).count) or IiF([HOTEL].currentmember.children.count=0, 1, count(decendants([hotel].currentmember,LEAVES)))
  This needs to be a dimesion formula in the account dimesion.
many thanks
ASKER CERTIFIED SOLUTION
Avatar of rama_krishna580
rama_krishna580
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

I have provided the full functional list for the Authors question and answer is there in the link
>>> Dimensions.Count. "Returns the number of dimensions in a cube, including the [Measures] dimension. " 
{Dimension|Hierarchy}.Levels.Count. "Returns the number of levels in a dimension or hierarchy, including the [All] level if applicable

points should be given.

R.K