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
harib
Post Patron
Post Patron

Conditional background color based on the other column

Hello Friends,

 

Is it possible to create background color for column based on the other column  like below table.

I have a Target and Performance column. Based on the Target ,performance column background should come.

Condition : if Performance > Target Green should come and if Performance < Target Red should come.

 

Target    Performace

75%         30%

85%        90%

65%        70%

 

Thanks in advance

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

So, the easiest way to do this would be to create a measure like:

 

Indicator = 
VAR __target = MAX('Table'[Target])
VAR __performance = MAX('Table'[Performance])
RETURN
IF(__performance < __target,"Red","Green")

Then you can base your conditional formatting off of that measure.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Mariusz
Community Champion
Community Champion

Hi @harib 

 

Yes, you can do the following.

Create a measure like below, you can replace my sum aggregation with Measures.

Conditional Formatting = 
INT( SUM( YourTable[Performance] ) > SUM( YourTable[Target] ) 

In table visual, under Filters > Values, right click on the field you want to apply the formatting on and go to Conditional formatting > Background color.

image.png

Nesxt, make sure you set everything as on the screenshot below.

image.png

Let me know if you ned any extra help

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

 

 

 

@Mariusz 

 

Hi Mariusz,

Forgot to inform you . Performance is a measure. It's not a column. Output  is not coming

If both are columns then it's working superb.

 

Can u please look into that .Thanks in advance

 

Thanks

Mariusz
Community Champion
Community Champion

Hi @harib 

Please see the below Measure adjusted for use with Measure, the rest is the same as previous post.

Conditional Formatting = 
INT( [Performance]  > [Target] ) 
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski


 

Greg_Deckler
Super User
Super User

So, the easiest way to do this would be to create a measure like:

 

Indicator = 
VAR __target = MAX('Table'[Target])
VAR __performance = MAX('Table'[Performance])
RETURN
IF(__performance < __target,"Red","Green")

Then you can base your conditional formatting off of that measure.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.