Forum Discussion

ase's avatar
ase
Frequent Visitor
2 years ago
Solved

Dynamic title field on a matrix

Hi all,

 

I have a matrix with a title, but it looks a bit ugly because the title field does not dynamically change based on the drill downs/ups. 

 

Do you know a way (setting) that would make the title adjust and follow the size of the table below? At this point even if I resize the fields below manually, there is still a gap between the title and the table. 

 

 

 

Thank you very much for the help in advance

 

Kind regards,

B

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ase ,

    There is a way to create a dynamic title for your matrix is to use a DAX measure that returns a text value based on the filter context of the matrix. You can then use the conditional formatting option in the title settings of the matrix to select the measure as the title text. For example, you can create a measure like this:

     

    Matrix Title =
    VAR current_month =
        SELECTEDVALUE ( Calendar[Month] )
    VAR current_year =
        SELECTEDVALUE ( Calendar[Year] )
    RETURN
        IF (
            ISFILTERED ( Calenda[Month] ) && ISFILTERED ( Calendar[Year] ),
            "Sales for " & current_month & " " & current_year,
            "Sales by Month and Year"
        )
    

     

    This measure will return a different title depending on whether the matrix is drilled down or up by month and year.

    Expression-based titles in Power BI Desktop - Power BI | Microsoft Learn

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

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

     

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ase ,

    There is a way to create a dynamic title for your matrix is to use a DAX measure that returns a text value based on the filter context of the matrix. You can then use the conditional formatting option in the title settings of the matrix to select the measure as the title text. For example, you can create a measure like this:

     

    Matrix Title =
    VAR current_month =
        SELECTEDVALUE ( Calendar[Month] )
    VAR current_year =
        SELECTEDVALUE ( Calendar[Year] )
    RETURN
        IF (
            ISFILTERED ( Calenda[Month] ) && ISFILTERED ( Calendar[Year] ),
            "Sales for " & current_month & " " & current_year,
            "Sales by Month and Year"
        )
    

     

    This measure will return a different title depending on whether the matrix is drilled down or up by month and year.

    Expression-based titles in Power BI Desktop - Power BI | Microsoft Learn

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

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