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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

How to colour some data in a table according the slicer selected

Hi all,

I need to colour some data of a specific table. I want to do that according a specific value entered in a slicer.

P.e. I choose 85. For Tª max <85 i want to colour in red; Tª max >85 in green

Have a look of my table.

dbb95_0-1606229891068.png

 

How can iI do that?

 

Thank you for your support!

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to set the value color based on the Slicer value, you can follow my steps:

  1. Create a measure(replace the table and column name with your current name):
Background color =

var _selected=SELECTEDVALUE('Ta Slicer'[Ta Slicer])

return

IF(MAX('Table'[Ta max])<_selected,"red","green")

 

  1. Go to the table chart->conditional formatting->background color on->advanced controls, then set like this:

v-robertq-msft_0-1606466156147.png

 

Then set the field font color to white, and you can get what you want, like this:

v-robertq-msft_1-1606466156155.png

 

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

3 REPLIES 3
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to set the value color based on the Slicer value, you can follow my steps:

  1. Create a measure(replace the table and column name with your current name):
Background color =

var _selected=SELECTEDVALUE('Ta Slicer'[Ta Slicer])

return

IF(MAX('Table'[Ta max])<_selected,"red","green")

 

  1. Go to the table chart->conditional formatting->background color on->advanced controls, then set like this:

v-robertq-msft_0-1606466156147.png

 

Then set the field font color to white, and you can get what you want, like this:

v-robertq-msft_1-1606466156155.png

 

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

amitchandak
Super User
Super User

@Anonymous , Create a color measure like given below and use that in conditional formatting option using "Field Value"

if([T max] <selectedValue('T Slicer'[Value]) ,"Red" , "Green")

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Please consider this solution

Don’t forget to accept the solution and/or click the thumbs up to leave kudos. Thank you!

 

Create a list of temperatures for your slicer, and a table of temperatures for your report.

Add this dax measure

RAG =

VAR mintemp = MIN(Mylist[Temperature])

VAR maxtemp = MAX(Mylist[Temperature])

RETURN

SWITCH(TRUE(),

SELECTEDVALUE(Mytable[Temperature]) < mintemp , "red",

SELECTEDVALUE(Mytable[Temperature]) > maxtemp , "red", 

"green"

)

 
In the report right click on Temperature > conditional formatting > background colour > format by = field value > based on field = RAG

 

Click here for example

https://1drv.ms/u/s!AgMTUY3Uvq3bg4kNji3xnt8L66tcDA?e=Hcotxn

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.