Forum Discussion

bharukc's avatar
bharukc
Icon for Helper I rankHelper I
3 years ago
Solved

Hide null values in matrix hierarchy

I am creating a hierachy

Id level 1, level 2, level 3 level 4 level 5 

1.   A.          B.         C

2.   A.          D.         E.        F

3.   M.         N.        O.         P.        Q

 

Is there a way where hierarchy stops when the value is null? 
for example, If I expand A, then I should see B and D, if I expand B, i should see C and no expand feature after C

 

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi bharukc ,

     

    Here I suggest you to create a measure by ISINSCOPE() for each level. Here I create a measure to count ID, if that level is blank, measure will return blank, if level is not blank, measure will return count.

    Measure = 
    IF(
        ISINSCOPE('Table'[level 5]),
        IF(MAX('Table'[level 5]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 4]),
        IF(MAX('Table'[level 4]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 3]),
        IF(MAX('Table'[level 3]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 2]),
        IF(MAX('Table'[level 2]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 1]),
        IF(MAX('Table'[level 1]) = BLANK(),BLANK(),COUNT('Table'[Id]))
        ))))
        )

    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.

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi bharukc ,

     

    Here I suggest you to create a measure by ISINSCOPE() for each level. Here I create a measure to count ID, if that level is blank, measure will return blank, if level is not blank, measure will return count.

    Measure = 
    IF(
        ISINSCOPE('Table'[level 5]),
        IF(MAX('Table'[level 5]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 4]),
        IF(MAX('Table'[level 4]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 3]),
        IF(MAX('Table'[level 3]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 2]),
        IF(MAX('Table'[level 2]) = BLANK(),BLANK(),COUNT('Table'[Id])),
        IF(ISINSCOPE('Table'[level 1]),
        IF(MAX('Table'[level 1]) = BLANK(),BLANK(),COUNT('Table'[Id]))
        ))))
        )

    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.

     

    • bharukc's avatar
      bharukc
      Icon for Helper I rankHelper I

      Anonymous , is there a way to add color to the last hierarchy before null?