Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Matrix Custom Color

Hi I have a Matrix Visual in power BI as follows

 

RGYNovemberDecember
Green280.516064229.5032663
Red59.28986904378.0103653
Yellow53.54121154

20.87497543

 

In Visualization Pane Rows=RGY,  Columns=MonthName,  Values=ProductQty

 

I need to show it as If RGY=Green then entire Row should be green,if red then entire row should be Red and so on..

 

Is this possible,if so Can someone please explain.

 

Thanks..

  • MFelix's avatar
    MFelix
    7 years ago
    Hi Anonymous,

    It's not possible to change the headers and totals based on a dinamic colour per line, conditional formating only availabl on values of matrix and tables.

    Regards
    MFelix

3 Replies

  • Hi Anonymous,

     

    Currently in PBI matrix and tables it's possible to connect a colour field to the condittional formatting in this way you can define the colour on your database and then return that to the matrix visualization however this will only apply to the data not to the headers of the rows or totals.

     

    You need to do the following:

    • Add the following measure to your model:

     

    ColourCode = SWITCH(SELECTEDVALUE(Table1[RGY]);
                "Green";	"#01B8AA";
                "Red";	"#FD625E";
             "Yellow";	"#F2C80F")
    • On the matrix select the conditional formatting, background colour
    • Format by Field Value:
    • Based on field select the measure ColourCode
    • Your table is filled with the colours you want.

     

    You can change the color codes by the ones you want you just need to keep the # before the codes.

     

    Check the detail and explanation of this feature in the link.

     

    Regards

    MFelix

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi MFelix,

                       Thank you.It worked for me.I downloaded latest version of power bi desktop to use conditional formatting based on field values.Also I have one more question ,is it possible to make RGY field names background  as Green,Red  .I mean the whole rows instead of just field values?

       

      Thanks

      Kan

      • MFelix's avatar
        MFelix
        Icon for Super User rankSuper User
        Hi Anonymous,

        It's not possible to change the headers and totals based on a dinamic colour per line, conditional formating only availabl on values of matrix and tables.

        Regards
        MFelix