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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Christofor
New Member

DYNAMIC Conditional Formatting based on the values of other fields?

Hi All-

 

I am looking to DYNAMICALLY conditionally format the values in a multi-row card based on their relationship to a target field.

 

I have NumberCompleted and TargetCompleted measures, and I'm looking for format the NumberCompleted measure in the card depending on its relationship to the Target Completed measure. The Target Completed and the number completed change daily, so I don't want to hard code in values.

 

Basically, IF (NumberCompleted >= (.9*Target Complete)), Green, 

               IF (NumberCompleted >= (.7*Target Complete)), Yellow, 

               IF (NumberCompleted <= (.7*Target Complete)), Red

 

I can't figure out a way to do this while maintaining values- it seems like reducing these to percentages would work because I could hard code in <70, 70-90, etc, but the value is preferred, and it's a situation that I've come across numerous times when I'd like to format based on things like historical averages for a field, etc. 

 

Any ideas?

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Christofor 

You can write a measure to use to apply the formatting.  Assuming your [Number Complete] and [Target Complete] are both measures, it would look like this.

Formatting = 
VAR _Result = DIVIDE ( [Number Completed], [Target Completed] )
RETURN
SWITCH(
    TRUE(),
    _Result >= .9, "Green",
    _Result >= .7, "Yellow",
    _Result < .7, "Red"
)

Make sure to set the format of the [Formatting] measure to Text.  I have applied it as the background color conditional formatting to the row field:

jdbuchanan71_0-1678476101177.png

 

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

@Christofor 

You can write a measure to use to apply the formatting.  Assuming your [Number Complete] and [Target Complete] are both measures, it would look like this.

Formatting = 
VAR _Result = DIVIDE ( [Number Completed], [Target Completed] )
RETURN
SWITCH(
    TRUE(),
    _Result >= .9, "Green",
    _Result >= .7, "Yellow",
    _Result < .7, "Red"
)

Make sure to set the format of the [Formatting] measure to Text.  I have applied it as the background color conditional formatting to the row field:

jdbuchanan71_0-1678476101177.png

 

Thank you so much! This has unlocked a whole new level for me!

Thanks so much! This has unlocked a whole new level for me. 

 

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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