Forum Discussion

sasdfasdfsad's avatar
sasdfasdfsad
Advocate IV
8 months ago
Solved

Matrix: No conditional formatting for rows?

I have a matrix with rows, all expanded set to tabular:
Customer Name, Status, Phone, Address

 

I want to set the Status column value to be red for certain statuses.

I don't see any way to do this with the matrix.

Cell Elements doesn't exist, conditional formatting, nor clicking on the field in the data well for rows and trying to apply conditional formatting.

 

*This is NOT for a measure, just the status field.  It's a text field is all.

  • Hi sasdfasdfsad 

     

    Download example PBIX file

     

    You're request isn't entirely clear.  You say you have rows Customer Name, Status, Phone, Address, but then you say Status is a column, so I'm not sure what your data or matrix look like.

     

    I'm going to proceed using this data

     

     

    Create a measure that will decide on the color of the Status field

     

    Measure = 
    
    VAR _status = SELECTEDVALUE(Data[Status])
    
    RETURN
    
    SWITCH( _status,
    
        "Bad" , "#FF0000",
    
        // Add other Status strings + Hex color codes here
    
        ""
    
    )

     

    Select the Conditional Formatting -> Background color for the Status 

     

     

     

    Use these settings for the Conditional Formatting rule

     

     

     

    If you want to apply this formatting to the entire row, apply the same rule to each of the fields/columns

     

     

     

    Regards

     

    Phil

     

  • Hi sasdfasdfsad 

    If you're referring to the categories, the dimensions that split matrix into columns and rows, those do not support conditional formatting. Only the fields in the value tiles can be conditionally formatted.

  • Hi sasdfasdfsad , Thank you for reaching out to the Microsoft Community Forum.

     

    ChandraTejaPhilipTreacy , Kedar_Pande  are correct about the key Power BI limitation you’re hitting, a text field placed in the Rows area of a Matrix cannot be conditionally formatted. Power BI only allows background or font colour rules on fields that live in the Values well, so trying to format Status directly in the row headers simply won’t show any options. danextian 's clarification aligns with this, only values can be formatted and Idrissshatila  is right that true row header colouring still isn’t supported today.

     

    What does work is shifting the formatting job to a measure in Values. The simple pattern is to create a measure that returns a colour based on the current Status, then add a tiny placeholder measure into Values and apply conditional formatting to it using Format style: Field value, pointing it at your colour measure. Once you hide the placeholder’s text and place it beside the Status row, you get the visual effect you wanted even though the Status field itself can’t be formatted.

     

    Thank you danextian , Kedar_Pande , PhilipTreacy , Idrissshatila & ChandraTeja  for your valuable responses.

8 Replies

  • ChandraTeja's avatar
    ChandraTeja
    Frequent Visitor

    sasdfasdfsad 
    You can't apply conditional formatting directly to text fields in the Rows header section of a Matrix, but there's a workaround using a measure in the Values bucket.

    DAX Measure 1 (Color Code): Create a measure that uses SWITCH(TRUE(), ...) based on MAX('YourTable'[Status]) to return a specific HEX Color Code (e.g., #FF0000).

    DAX Measure 2 (Placeholder): Create a simple measure, like Placeholder_Value = 1.

    Matrix Setup: Put the Placeholder_Value into the Values well.

    Formatting: Apply Conditional formatting (Background/Font Color) to the Placeholder_Value. Choose Format style: Field value, and base it on your Color Code Measure.

    Clean Up: Hide the '1' value (by setting its font color to match the background color) and position the placeholder column right next to your Status column.

    This effectively creates a colored "shadow column" that acts as your conditional formatting.

  • Hi sasdfasdfsad 

     

    Download example PBIX file

     

    You're request isn't entirely clear.  You say you have rows Customer Name, Status, Phone, Address, but then you say Status is a column, so I'm not sure what your data or matrix look like.

     

    I'm going to proceed using this data

     

     

    Create a measure that will decide on the color of the Status field

     

    Measure = 
    
    VAR _status = SELECTEDVALUE(Data[Status])
    
    RETURN
    
    SWITCH( _status,
    
        "Bad" , "#FF0000",
    
        // Add other Status strings + Hex color codes here
    
        ""
    
    )

     

    Select the Conditional Formatting -> Background color for the Status 

     

     

     

    Use these settings for the Conditional Formatting rule

     

     

     

    If you want to apply this formatting to the entire row, apply the same rule to each of the fields/columns

     

     

     

    Regards

     

    Phil

     

  • sasdfasdfsad 

     

    Workaround that usually works well:

    Create a measure used in Values (e.g. Status Display = SELECTEDVALUE('Table'[Status])).

    Remove the Status field from Rows; keep only Customer, Phone, Address as rows.

    Put Status Display in Values.

    On the measure in Values, use Conditional formatting > Font color (or Background) and set rules for each status

     

  • Hi sasdfasdfsad 

    If you're referring to the categories, the dimensions that split matrix into columns and rows, those do not support conditional formatting. Only the fields in the value tiles can be conditionally formatted.

  • v-hashadapu's avatar
    v-hashadapu
    Community Support

    Hi sasdfasdfsad , Thank you for reaching out to the Microsoft Community Forum.

     

    ChandraTejaPhilipTreacy , Kedar_Pande  are correct about the key Power BI limitation you’re hitting, a text field placed in the Rows area of a Matrix cannot be conditionally formatted. Power BI only allows background or font colour rules on fields that live in the Values well, so trying to format Status directly in the row headers simply won’t show any options. danextian 's clarification aligns with this, only values can be formatted and Idrissshatila  is right that true row header colouring still isn’t supported today.

     

    What does work is shifting the formatting job to a measure in Values. The simple pattern is to create a measure that returns a colour based on the current Status, then add a tiny placeholder measure into Values and apply conditional formatting to it using Format style: Field value, pointing it at your colour measure. Once you hide the placeholder’s text and place it beside the Status row, you get the visual effect you wanted even though the Status field itself can’t be formatted.

     

    Thank you danextian , Kedar_Pande , PhilipTreacy , Idrissshatila & ChandraTeja  for your valuable responses.

  • v-hashadapu's avatar
    v-hashadapu
    Community Support

    Hi sasdfasdfsad , hope you are doing great. May we know if your issue is solved or if you are still experiencing difficulties. Please share the details as it will help the community, especially others with similar issues.

  • v-hashadapu's avatar
    v-hashadapu
    Community Support

    Hi sasdfasdfsad , Hope you're doing okay! May we know if it worked for you, or are you still experiencing difficulties? Let us know — your feedback can really help others in the same situation.