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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
pmusram
Regular Visitor

How to do conditional formatting so that it changes dynamically??

Hi community!!

I have been given data and from which I have made a table in which there is a column name Average salary and I am having slicer of dates. I want to have a green color if values are above their column's net average and have to be red if they are below net average.

Problem is net average will have to change dynamically and so as colors relatively.How can I do the same???

 

Thanks in Advance

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@pmusram , Assume you have measure [Avg Salary]

 

Avg Salary overall = averageX(allselected(Table),[Avg Salary])

 

create a measure like

 

Color = Switch(True() ,

[Avg Salary] >=[Avg Salary overall] , "Green",

"Red"

)

 

Use this measure in conditional formatting with field value option

 

refer for steps

https://www.youtube.com/watch?v=RqBb5eBf_I4

 

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

View solution in original post

4 REPLIES 4
pmusram
Regular Visitor

@amitchandak Thanks for helping me once again. Solution Worked for me.

MintuBaruah
Helper III
Helper III

Hello @pmusram 

 

I tried this by taking an example of years and Average Salary.

Screenshot 1:

ComAns1.PNG

Screenshot 1 shows the Values after conditional formatting.

For condition formatting Navigate to Format-> Data Colors-> click on fx

 

Then apply the below changes(refer to screenshot 2), I took 100000 as the net average

Screenshot 2: 

ComAns2.PNG

 

Regards,
And if you find the solution useful please mark my post as a solution!
In doing so, you are also helping me. Thank you!
Mintu Baruah

@MintuBaruah Thanks for helping me out.Your solution has helped me but not answered my question as I need to conditional formatting. As my data will change it has to vary accordingly.You can see @amitchandak his answer once .

amitchandak
Super User
Super User

@pmusram , Assume you have measure [Avg Salary]

 

Avg Salary overall = averageX(allselected(Table),[Avg Salary])

 

create a measure like

 

Color = Switch(True() ,

[Avg Salary] >=[Avg Salary overall] , "Green",

"Red"

)

 

Use this measure in conditional formatting with field value option

 

refer for steps

https://www.youtube.com/watch?v=RqBb5eBf_I4

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.