Forum Discussion

mmrisk's avatar
mmrisk
Frequent Visitor
1 year ago
Solved

Formatting two Column Headers in a Matrix table

Hi,

 

I have two columns in Matrix view and I would like to change the text color of one of the Column headers.

My columns are Status and Risk:

 

In the matrix below, I'd like Deferred & Overdue be a different color than Low/Medium/High. 

 

 

Deferred and Overdue are from column Status, while Low/Medium/High are from Risk. 

 

 

Formatting by Specific Column doesn't work, as the only Series I can select is the Values, not the Columns:

 

Thanks for your help

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi mmrisk ,

     

    Power BI does not currently support individual column header colors and can only set a uniform color for all column headers.

     

    But you can try the following workaround by using the measure header to replace the column header of a field.

     

    Create the following measures to represent the values under different 'Risks'.

     

    Low = CALCULATE( SUM('Table'[Value]), 'Table'[Risk] = "Low")
    Medium = CALCULATE( SUM('Table'[Value]), 'Table'[Risk] = "Medium")
    High = CALCULATE( SUM('Table'[Value]), 'Table'[Risk] = "High")

     

     

    Use these three measures as the value of the matrix.

     

    Set the font color for the headers of each of the three measures.

    In this way, the 'Status' column header color is black.
    And the measure value header replaces the 'Risk' column header, which can be set to a different color.

     

    Please see the attaced pbix for referenece.

     

    Best Regards,
    Dengliang Li

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

4 Replies

  • freginier's avatar
    freginier
    Solution Sage

    Hey there!

     

    You could try using Conditional Formatting with a Measure:

    Power BI does not allow direct header formatting, but you can trick it by adding a dummy measure.

    Create this DAX formula:

    HeaderColor =
    SWITCH(
    SELECTEDVALUE(YourColumn),
    "Deferred", "#FF0000", // Red
    "Overdue", "#FF0000", // Red
    "Low", "#000000", // Black
    "Medium", "#000000", // Black
    "High", "#000000", // Black
    "#000000" // Default
    )

     

    Apply this measure to the "Text color" in conditional formatting under the Values section.

     

    Hope this helps!

    😁😁

    • mmrisk's avatar
      mmrisk
      Frequent Visitor

      Thank you for your help.

       

      I couldn't get this to work as the Conditional Formatting  for Font Color ( in Cell Elements) doesn't change the column headers, just the column values. And I couldn't find any other spots where I could add in this measure. In a matrix table, it seems the only place you can use conditional formatting in is the Values (per above) and the table Title.

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi mmrisk ,

     

    Power BI does not currently support individual column header colors and can only set a uniform color for all column headers.

     

    But you can try the following workaround by using the measure header to replace the column header of a field.

     

    Create the following measures to represent the values under different 'Risks'.

     

    Low = CALCULATE( SUM('Table'[Value]), 'Table'[Risk] = "Low")
    Medium = CALCULATE( SUM('Table'[Value]), 'Table'[Risk] = "Medium")
    High = CALCULATE( SUM('Table'[Value]), 'Table'[Risk] = "High")

     

     

    Use these three measures as the value of the matrix.

     

    Set the font color for the headers of each of the three measures.

    In this way, the 'Status' column header color is black.
    And the measure value header replaces the 'Risk' column header, which can be set to a different color.

     

    Please see the attaced pbix for referenece.

     

    Best Regards,
    Dengliang Li

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

    • mmrisk's avatar
      mmrisk
      Frequent Visitor

      Than you very much,

       

      This solution works for me.

       

      The caveat for other users is that you will need to do additional work to create a Grand Total that sums the individual Low/Medium/High values.

       

      Thanks again.