Forum Discussion

taylororiger's avatar
taylororiger
Helper II
4 years ago
Solved

Background Color manually

I am trying to assign a backgroud color to certain rows in my table.  However, the background color relies on 2 different criteria instead of 1, so I don't think I am able to achieve this in the conditional formatting route.  Is there a way to manually select rows to have a background color?

  • vojtechsima's avatar
    vojtechsima
    4 years ago

    Hey, man  taylororiger 
    I did test it again, I tried to recreate something that you have and used the exact same formula:

    Measure = SWITCH(TRUE(),
    ISBLANK(MAX('PE Relationship Detail'[Engagement Quality Reviewer Name]))&&MAX('PE Relationship Detail'[PE total fees])>500000,"yellow")


    Applied to all columns and it works, the only thing that can be wrong is that make sure your blanks are actually blank, notice that in Power Query, blanks are "null". This won't appear in the Visual layer, however, make sure you can see it like that in power query:

    You can replace it like this:

    if you don't want to test and debug anything, you can add something like to your formula that checks either blank or empty string:

    Measure = SWITCH(TRUE(),
    (ISBLANK(MAX('PE Relationship Detail'[Engagement Quality Reviewer Name])) || MAX('PE Relationship Detail'[Engagement Quality Reviewer Name])="")&&MAX('PE Relationship Detail'[PE total fees])>500000,"yellow")

    This should work even when you don't have your blank rows actually blank. 
    So try this new formula first and lemme know.

25 Replies

  • Hi, taylororiger 
    I believe there is no way, how to manually select certain rows and colour them, however, you can definitely write a measure even with 10 conditions to colour your row.
    Write a measure something like this: 

     

     

     

     

    SWTICH(TRUE(),
    Table[Column]=1, "#FFF",
    Table[Column]=1 && Table[Column2]=1 && Table[Column4]=50, "#0FF"
    Table[Column]=64, "#DDD",
    "#000")

     

     

     

     

    Then, in Conditional Formatting, just use Value of Field, put your measure there and you should achieve your result.

    Here's the in-depth guide:

    https://xxlbi.com/blog/conditional-formatting-by-field-value-in-power-bi/

     
      • vojtechsima's avatar
        vojtechsima
        Super User

        taylororiger 
        Anywhere, just click on "New Measure" as you would for normal measure and write it, Measures don'T have to be located in the particular table in order to work.