Forum Discussion

VanshikaB's avatar
VanshikaB
Frequent Visitor
1 year ago
Solved

Creating Hierarchy for measures

Hi, How to create hierarchy for measures in matrix table?   As shown in the pic below, Net Sales is at top (has level 1 hierarchy) and 'Net Trade Sales' and 'Trade Sales' have a level 2 hierarchy  ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi VanshikaB ,

     

    I think you can try ISINSCOPE() function to update your measure.

    In my sample:

    Display Sales =
    VAR _1 =
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( 'Hierarchy'[Level 2] ) = "Net Trade Sales", [Net Trade Sales],
            SELECTEDVALUE ( 'Hierarchy'[Level 2] ) = "Trade Sales", [Trade Sales],
            SELECTEDVALUE ( 'Hierarchy'[Level 1] ) = "Net Sales", [Net Sales],
            SELECTEDVALUE ( 'Hierarchy'[Level 1] ) = "Interco Sales", [Interco Sales],
            BLANK ()
        )
    RETURN
        IF (
            ISINSCOPE ( 'Hierarchy'[Level 2] ),
            IF ( MAX ( 'Hierarchy'[Level 2] ) = BLANK (), BLANK (), _1 ),
            IF ( ISINSCOPE ( 'Hierarchy'[Level 1] ), _1 )
        )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.