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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
PwrBI01
Post Patron
Post Patron

Conditional formatting according to a value

Hi guys,

 

I have a table with sales from 2020 and 2021 for different people and I would like to create a conditional formatting that do the following:

Imagen3png.png

 

For the column Sales 2021 and variation I would like to do the following:

1- If the value for that person is higher than the average put a green color.

2- If the value for that person is lower than the average put a red color.

3- If the value for that person is equal to the average put a yellow color.

 

I would like to know how can I do 'Option 1' and 'Option 2'

 

The file is https://www.dropbox.com/s/v7r5mk7kvt9w041/Problem%20Power%20BI.pbix?dl=0

 

Thanks in advance.

 

Regards.

 

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Please set these options separately:

Vlianlmsft_2-1624945390680.png

 

Vlianlmsft_1-1624945012409.png

 

View solution in original post

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Please set these options separately:

Vlianlmsft_2-1624945390680.png

 

Vlianlmsft_1-1624945012409.png

 

Thank you very much,

 

That is the solution I needed, so I will accept is as solution, but I have a new question that can be really easy but I don't know how to do it.

 


Variation 2021/2020 = (Sales 2021 - Sales 2020)/Sales 2020

So, if there is no data for Sales 2020 the result will be Blank, how can I put that if the result is blank it shouldn't show a color?, currently it will show a red color

amitchandak
Super User
Super User

@PwrBI01 , You can create a color measure.

assume you have measure [sales 2021]

color measure =

var _avg = calculate(averagex(values(Table[Name]), [sales 2021]), allselected())

return

switch(true() ,

[sales 2021] > _avg  , "green",

[sales 2021] = _avg  , "yellow",

[sales 2021] < _avg  , "red"

)

 

 

use it conditional formatting using the field value option

refer for steps

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

 

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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