Forum Discussion

Richard_Halsall's avatar
3 years ago
Solved

Matrix Conditional Formatting for row value which is text

Hi,

I have created a calculated column to enable me to colour a text value in a matrix visualisation - these values are correct.

 

However when I use this to colour a text value in a matrix I am getting incorrect results - the cell should be coloured red if the value is No Technician - I have attached a screenshot of the visual.

 

The conditional formatting rule is

 

Any suggestions would be appreciated as I am struggling to understand why this does not work. Thanks

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Richard_Halsall ,

    In order to make troubleshooting and give you a suitable solution quickly, could you please provide the following info?

    1. Some raw data with Text format(exclude sensitive data)

    2. If the field RoleFilledColour is a calculated column, please provide the related formula

    3. How did you set your matrix visual? (Fields option settings)

    4. What's your expected result? Do you want to make the backgroud color is red if the value is "No Technician", otherwise, green?

    Best Regards

5 Replies

  • Richard_Halsall , Prefer to create a color measure, not column

     

    examples

     

    Measure =
    Switch(true(),
    max(Table[Column]) = "R1" , "Red" ,
    max(Table[Column]) = "R2" , "Green" ,
    max(Table[Column]) = "R3" , "Pink "
    )

     

    or

     

    Switch( True() ,
    [Percent] =1 , "Green"
    [percent] <.75 , "red",
    [percent] <.99 , "Yellow"
    )

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Richard_Halsall ,

    In order to make troubleshooting and give you a suitable solution quickly, could you please provide the following info?

    1. Some raw data with Text format(exclude sensitive data)

    2. If the field RoleFilledColour is a calculated column, please provide the related formula

    3. How did you set your matrix visual? (Fields option settings)

    4. What's your expected result? Do you want to make the backgroud color is red if the value is "No Technician", otherwise, green?

    Best Regards

    • Richard_Halsall's avatar
      Richard_Halsall
      Helper IV

      Hi,

      1) Link to data

      2) I have tried with a column 

      RoleFilledColour =
          SWITCH(TRUE(),
              'FactDemandAllocation'[TechnicianName]="No Technician","Red","Green")
      And a measure
      RoleFilled =
      SWITCH(
          TRUE(),
          MAX(FactDemandAllocation[TechnicianName]) = "No Technician", "Red",
          MAX(FactDemandAllocation[TechnicianName]) <> "No Technician", "Green"
      )
       
      3) 

       

      4) I would like to make the background color red if the value is "No Technician", otherwise, green

       

      The matrix is affected by slicers with relationships to the date field and opportunity field of the data

       

      Thanks