Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Color cell in table view

Hi 

 

I have created one Power BI report and I am showing up one table view in my report. There is one column in my table which is holding values as "R", "G" and "Y" and I want to show "R" cell with RED background color, "G" with Green color and cell with "Y" value with Yellow color as Backgroud color. Is this possible ?

 

  • Make sure you have latest Power BI Installed.

     

    1. Create a Custom Column and assign the Color Codes by using Switch function. Example:

    ColorCodes = SWITCH(TRUE(),
                Table1[Color Symbol] = "B", "#0000FF",
                Table1[Color Symbol] = "R", "#FF0000",
                Table1[Color Symbol] = "G", "#008000",
                Table1[Color Symbol] = "Y", "#FFFF00")

    2. Go to formatting Tab, select Conditional Formatting and then Select Background and then Select Field Value and then Select ColorCodes Column from the list. I.e.

     

4 Replies

  • rocky09's avatar
    rocky09
    Solution Sage

    Make sure you have latest Power BI Installed.

     

    1. Create a Custom Column and assign the Color Codes by using Switch function. Example:

    ColorCodes = SWITCH(TRUE(),
                Table1[Color Symbol] = "B", "#0000FF",
                Table1[Color Symbol] = "R", "#FF0000",
                Table1[Color Symbol] = "G", "#008000",
                Table1[Color Symbol] = "Y", "#FFFF00")

    2. Go to formatting Tab, select Conditional Formatting and then Select Background and then Select Field Value and then Select ColorCodes Column from the list. I.e.

     

    • OU812's avatar
      OU812
      Advocate I

      rocky09 thank you for your answer. I believe that is exactly what I need as well. However, I am so new to PowerBI, I don't even know where to put that DAX code. Can you provide some more detailed steps to implement your answer. I believe I can figure out how to add the column in the table. But some more on that might be helpful as well. Piecing all this together off YouTube videos and forum posts has been rough. Thank you!

  • Militambe3171's avatar
    Militambe3171
    Frequent Visitor

    Step 1 Create custom column assign value(numeric 1=red, 2=green, 3=yellow to them using conditional column (for e.g. new column name "index")

    Step 2 once created select column which you want to format

     

    Step 3 go to conditional formating >> backgroung formating >> formating applies to  (select column)

     

    Step 4 colors by rule

     

    1 is red

    2 is green

    3 is yellow

     

  • emembreno81's avatar
    emembreno81
    Frequent Visitor

    is there a way to do this formula for multiple columns?  My example is that I've created a series of columns that all show either a task as "COMPLETE" or "INCOMPLETE".  I want any instance with "INCOMPLETE" to be shown as a red box across a series of 2-6 columns.  Is this something that is do-able?