Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Can we format row header in Matrix Visualisation in Power Bi?

I have a matrix visualizations.

 
 
 
 
 

I want to format the row headers on expanding and collapsing.

Use case is that in the matrix visual, Show values as Y if Years are visual,
if Years are extended to Quarters, show Q
else if Quarters are extended to Months show M

Is it possible in matrix visual ? If yes, then how can i implement this?

Thanks in advance!!

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous 

    I build a sample like yours to have a test.

    Build a matrix visual:

    Then build measure to achieve your goal.

    Measure use IF function:

    Total Sales =
    
    IF (
    
        ISINSCOPE ( 'Table'[Year].[Day]),
    
        SUM('Table'[Sales]),
    
        IF (
    
            ISINSCOPE ( 'Table'[Year].[Month]),
    
            "M",
    
            IF (
    
                ISINSCOPE ( 'Table'[Year].[Quarter] ),
    
                "Q",
    
                IF ( ISINSCOPE ( 'Table'[Year].[Year] ), "Y",SUM('Table'[Sales]))
    
            )
    
        )
    
    )

    Or you can use a measure use Switch function:

    Total Sales 2 =

    SWITCH (
    
        TRUE (),
    
        ISINSCOPE ( 'Table'[Year].[Day] ), SUM ( 'Table'[Sales] ),
    
        ISINSCOPE ( 'Table'[Year].[Month] ), "M",
    
        ISINSCOPE ( 'Table'[Year].[Quarter] ), "Q",
    
        ISINSCOPE ( 'Table'[Year].[Year] ), "Y",
    
        SUM ( 'Table'[Sales] )
    
    )

    Result:

    You can download the pbix file from this link: Can we format row header in Matrix Visualisation in Power Bi?

     

    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. 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    I build a sample like yours to have a test.

    Build a matrix visual:

    Then build measure to achieve your goal.

    Measure use IF function:

    Total Sales =
    
    IF (
    
        ISINSCOPE ( 'Table'[Year].[Day]),
    
        SUM('Table'[Sales]),
    
        IF (
    
            ISINSCOPE ( 'Table'[Year].[Month]),
    
            "M",
    
            IF (
    
                ISINSCOPE ( 'Table'[Year].[Quarter] ),
    
                "Q",
    
                IF ( ISINSCOPE ( 'Table'[Year].[Year] ), "Y",SUM('Table'[Sales]))
    
            )
    
        )
    
    )

    Or you can use a measure use Switch function:

    Total Sales 2 =

    SWITCH (
    
        TRUE (),
    
        ISINSCOPE ( 'Table'[Year].[Day] ), SUM ( 'Table'[Sales] ),
    
        ISINSCOPE ( 'Table'[Year].[Month] ), "M",
    
        ISINSCOPE ( 'Table'[Year].[Quarter] ), "Q",
    
        ISINSCOPE ( 'Table'[Year].[Year] ), "Y",
    
        SUM ( 'Table'[Sales] )
    
    )

    Result:

    You can download the pbix file from this link: Can we format row header in Matrix Visualisation in Power Bi?

     

    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. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      For Example:-

      When I expand 2013 to the next level ie- Quarter then 2013 would be converted into text "Y" and when again I expand Quarter to next level then it would change to "Q" and so on .. for months as "M".

      So, while expanding and collapsing, row header should be converted to the text that we provide.

      Row header should be edited in every time on expanding the hiearchy. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your problem or share me with your pbix file from your onedrive business.

     

    Best Regards,

    Rico Zhou