Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
YunJ
Post Prodigy
Post Prodigy

How to set background color?

hi,

I met two problems when I use background color.

First, when I use "Format by Field value", it errors and says don't recognize.

1.png2.png

Second, I want to set the color for rows of matrix for which Sales2 is not blank. But the only way I can do this is set for each measure right? For example, when I set Sales background color, I cannot find "is not blank". 

I also think it's tricky to set for each measure. I want the whole row to be colored only if Sales2 is not blank.

3.png

Here is the pbix file: 

https://www.dropbox.com/s/5s5drfgix1xhsut/conditional%20color.pbix?dl=0

Thanks a lot!

1 ACCEPTED SOLUTION

Hi @YunJ ,

 

Create a measure and set it in Conditional formatting.

Measure = IF(MAX('Number'[Sales2])<>BLANK(),"light blue")

15.png

16.png

 

 

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @YunJ ,

Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


Best Regards,
Stephen Tao

amitchandak
Super User
Super User

@YunJ , to use the field value option. You need to return color. Create a measure that return color name or hexcode

example

Colour = 
SWITCH(TRUE(),
'Table'[Date] < TODAY(), "red",
'Table'[Date] = TODAY(), "orange",
"green")

Colour = 
SWITCH(TRUE(),
max('Table'[Month Year]) = "Jan-2020", "red",
Max('Table'[Month Year]) < "Feb-2020", "orange",
//keep on adding
"green")

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

Check

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Hi @amitchandak Thanks for sharing. Do you have any thought on the second question? I want to set color for rows where Sales2 is not blank.

 

Thanks a lot for your time!

Hi @YunJ ,

 

Create a measure and set it in Conditional formatting.

Measure = IF(MAX('Number'[Sales2])<>BLANK(),"light blue")

15.png

16.png

 

 

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.