Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

MDX CALCULATED LEAF MEMEBER COUNT in MS Analysis Serveice

Posted on 2004-09-09
Medium Priority
421 Views
I have put together a cube to analyse sales to certain hotels in MS Analysis Services. 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
0
Question by:GhostRider10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 17

Accepted Solution

BillAn1 earned 2000 total points
ID: 12014984
Try something like this (the calulcated member is called HotelCount)

iif(isleaf([HOTEL]),1, sum([HOTEL].children,[Measures].[HotelCount] ))
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month4 days, 19 hours left to enroll