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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.