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 t...
  • PhilipTreacy's avatar
    8 months ago

    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

     

  • danextian's avatar
    8 months ago

    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
    8 months ago

    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.