cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
corpsikumar
Regular Visitor

formatting based on another column

Hi Power Users,

I'm trying to do conditional formatting in matrix visual for one column  based on another column. 

 

If column1 is > or = Column2 then background of column1 should be Yellow

If column1 is not equal to but close to Column2, background should be Red

If column1 is less than but close to Column2 background should be Black

If column1 very low compared to Column2, background should be Blue

 

I need to do like above, Please help. 

 

Thanks

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

Hi @corpsikumar ,

 

This is how I understand your judgment sentence
If column1 is much larger than column2 (ie column1-column2>=1) or column1=column2, the background color is yellow.
If column1 is greater than column2 and close to column2 (ie 0<column1-column2<1), the background color is red.
If column2 is smaller than column2 and close to column2 (that is, -1<column1-column2<0), the background color is black.
If column1 is much smaller than column2 (ie column1-column2<=-1), the background color is blue.

Measure = var _tt=MAX('Table'[Column1])-MAX('Table'[Column2])
return IF(_tt>0&&_tt<1,"Red",IF(_tt=0||(_tt>=1),"Yellow",IF(_tt>-1&&_tt<0,"Black",IF(_tt<=-1,"Blue"))))

Screenshot 2021-06-17 174925.pngScreenshot 2021-06-17 174845.png

 

Reference: Use conditional formatting in tables

 

 

 

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.

 

 

Hi 

Thanks for the response. I can not use MAX function because the columns that i have is percentages. 

Hi @corpsikumar ,

 

Sorry I don't quite understand what you mean. Why can't the MAX function be used for percentages? Have you tried it yourself? If it really doesn't work, please tell me what the data looks like, and you can provide me some similar dummy data.

 

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.

amitchandak
Super User IV
Super User IV

@corpsikumar , You have to create a color column , but prefer a measure and use that in conditional forammting using field value option

color column =

Switch( True() ,

[column1] >= [Column2] , "Yellow",

//Add others 

"red"

)

 

color Measure =

Switch( True() ,

sum([column1]) >= sum([Column2]) , "Yellow",

//Add others 

"red"

)

 

Not very clear what do you mean by close to

 

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors