Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Background color for a row table/matrix

Hi,

 

I would like to add a background color for a row. Conditional formatting only works for columns.

 

I would like to add a color for the whole GLOBAL row only. Please help

It should look like this (global row all one color)I'm using alternating rows but not what I want

 

 

  • Hi Anonymous ,

     

    You can create a measure and use the new 'Conditional Formating' option where you select formatting by

    'Field Value' and in this you choose the measure shown below.

    You do this for every column.

     

    COLOUR GLOBAL PROJECT ROW = 
    
    IF  (HASONEVALUE(Projects[Project])
        ,IF( FIRSTNONBLANK('Projects'[Project] , 0) = "GLOBAL"
            ,"lightgreen"
            ,"white"
        )
        ,BLANK()
    )

    Conditional Formatting- Select the measure here.Apply to every column, works for matrix and table

    SAMPLE PBIX

     

    Maria

5 Replies

  • MariaP's avatar
    MariaP
    Icon for Solution Supplier rankSolution Supplier

    Hi Anonymous ,

     

    You can create a measure and use the new 'Conditional Formating' option where you select formatting by

    'Field Value' and in this you choose the measure shown below.

    You do this for every column.

     

    COLOUR GLOBAL PROJECT ROW = 
    
    IF  (HASONEVALUE(Projects[Project])
        ,IF( FIRSTNONBLANK('Projects'[Project] , 0) = "GLOBAL"
            ,"lightgreen"
            ,"white"
        )
        ,BLANK()
    )

    Conditional Formatting- Select the measure here.Apply to every column, works for matrix and table

    SAMPLE PBIX

     

    Maria

    • zendu's avatar
      zendu
      Icon for Microsoft Employee rankMicrosoft Employee

      This is not really a solution. It is a workaround. It is overhead to copy this for every column in long run of the report.

    • Anonymous's avatar
      Anonymous
      Not applicable

       

      UPDATE:  I have found the answer on another thread here: https://community.powerbi.com/t5/Desktop/Apply-a-color-based-on-year-differentiate-each-year-with/m-p/1551449


      Hi Maria,  this really helped me too.  I was wondering if it is possible to add another DAX formula in to colour a different row another colour.  

      for example in the example presented above, if I wanted to also colour the 'APAC' row in yellow?  Is this possible at all please?  

    • Noredlac86's avatar
      Noredlac86
      Icon for Helper I rankHelper I

      Hi MariaP 

      I was wondering if its possible to change the color for the "ROWS" using a matrix chart. I mean your code works 100% if i use a table, but if i use Matriz, does not work.

      I have this:

       

      and i want to change the color of the rows (I mean the text in the first column, A) 0-15Days.... etc.

      Im using matrix chart. I need that the first row, will be total green, the second one total yellow and go on, but your code just works for values.

      Do you know if there is any workaround.?

      • Ashokrajm's avatar
        Ashokrajm
        Frequent Visitor

        Did you find any soloutions to this?