MDX Cube Calculation Help (long)

  • Hello All,

    I have been working with SSAS/Multidimensional for a few years now, although I would classify my MDX skills as fair at best. I’ve recently constructed a cube with Human Resources content and have an interesting (and baffling to me) problem I am trying to solve through MDX. The end goal here would be to come up with a few cube calculations for the measures of interest.

    Background: One of the measures in the cube surrounds personnel actions (hires, terminations, promotions, organization changes, job changes, etc.) and provides an action type/employee identifier. The principal measure value used is a Distinct Count on the Employee ID. For this problem, I am only interested in the action type = TRANSFER, which is a record that indicates a person has moved from one department to a different one. Part of the referential information in the TRANSFER record is the department ID of the FROM department and the TO department.

    The cube has a role playing Organization dimension hierarchy that is used for both the FROM department ([Org PIT – FROM ACTION]) and the TO department ([Org – PIT]). The non-ragged hierarchy has the following levels (highest to lowest): [Lab], [Executive VP], [Division], [Center], [Group], [Department], [Team]. The query that follows focuses on the Division level, however I would like it to be able to be flexible enough to work at least the top 4 levels of the hierarchy (Lab, Executive VP, Division, Center) if possible. (Side note: The TO Organization structure is used almost exclusively in the cube and has relationship to many other measures. The FROM Organization structure is only used in this calculation and will be hidden from general use so as not to confuse the user population.)

    This pivot table (uploaded attachment) demonstrates the employee counts at the Division level of the Organization hierarchies. On rows is the Organization that the employee comes FROM. On Columns is the Organization that they are going TO as a result of the TRANSFER action.

    Note that the intersection of where a FROM Division equals a TO Division represents internal movement of employees within that Division (e.g. there were 125 employees that moved FROM a department within Division “D”, TO a department within Division “D”, highlighted in yellow).

    I’ve been able to replicate the movement at the Division level with this query:

    SELECT

    [Measures].[Employee Count - JOBHIST] ON COLUMNS

    ,NON EMPTY

    (

    [Org - PIT FROM ACTION].[Org Hierarchy].[Division]

    ,[Org - PIT].[Org Hierarchy].[Division]

    ) ON ROWS

    FROM [ARCHR]

    WHERE

    {

    (

    [Time].[Fiscal].[Fiscal Year].&[2016]

    ,[Actions].[Action Hierarchy].[Action].&[XFR]

    )

    };

    A partial result set…

    FROM DivisionTO DivisionEmployee Count - JOBHIST

    AA2

    AC1

    AD1

    BB109

    BC3

    BD4

    BE1

    BJ1

    CB4

    Which you will note replicates the values at the appropriate intersections in the pivot table above.

    My hope is to use this as a portion of the overall calculations I am trying to accomplish.

    1.Transfers WITHIN an Organization Level (how many employees transferred to departments within Division highlighted in yellow)

    2.Transfers OUT OF an Organization Level (how many employees transferred to departments outside of the Division, e.g. 5 + 4 + 1 + 2 + 3 highlighted in orange

    3.Transfers INTO an Organization level (how many employees transferred into departments within the Division from outside Divisions, e.g. 1 + 4 + 8 + 4 + 1 + 1 = 19, highlighted in green.

    I have been fooling around with IIF statements within the member to hopefully display the employee count when the value of the FROM Division equals the value in the TO Division, or display a NULL when they are not equal:

    iif([Org - PIT FROM ACTION].MemberValue = [Org - PIT].MemberValue

    ,{[Measures].[Employee Count - JOBHIST]}

    ,NULL

    )

    Which seems like a reasonable approach, but doesn’t work.

    Can anyone offer guidance? Thanks in advance.

    -Jim

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply