How to get a set with lastchild of each parent

  • How to get a set with lastchild of each parent in a hierarchy, please see the attach image

    my MDX query :

    select {[Measures].[H Movimientos Count]} on 0,

    {descendants([D Movimientos].[Elemento - Movimiento].[Id Elemento].members, [D Movimientos].[Elemento - Movimiento].[Id Mov])} on 1

    from [Test];

    but this return all child 🙁

  • There is a LastChild() function you can use for that. Syntax can be found here: https://msdn.microsoft.com/en-us/library/ms145576.aspx

  • yes i know that, but i need get all lastchild of each parent.

  • with member [Measures].[Last Sibling]

    as

    (

    [D Movimientos].[Elemento - Movimiento].currentmember.parent.lastchild.name

    )

    select{

    [Measures].[H Movimientos Count]

    ,[Measures].[Last Sibling]

    } on 0

    ,{

    [D Movimientos].[Elemento - Movimiento].[Id Elemento]

    } on 1

    from[Test]

Viewing 4 posts - 1 through 3 (of 3 total)

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