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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Fusilier
Helper III
Helper III

Conditional colour formatting

Is it possible to create a conditional colour format based on % difference from a target value to change the background colour of a card visual?

For example if a value is 50% higher than target show dark green? So, if the target is 100 and actual is 200 then dark green etc?

Would that be achieved using rules or field value?

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Fusilier 

 

Create a measure similar to below:

VAR _target = [target measure or target value]
VAR _actual = [actual measure]
VAR _diff = _actual - _target
VAR _pct =
    DIVIDE ( _diff, _target )
RETURN
    SWITCH ( TRUE (), _pct > 0.5, "green", "red" )

Use this to conditionally format a card's background using field value

danextian_0-1745645985212.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

8 REPLIES 8
danextian
Super User
Super User

Hi @Fusilier 

 

Create a measure similar to below:

VAR _target = [target measure or target value]
VAR _actual = [actual measure]
VAR _diff = _actual - _target
VAR _pct =
    DIVIDE ( _diff, _target )
RETURN
    SWITCH ( TRUE (), _pct > 0.5, "green", "red" )

Use this to conditionally format a card's background using field value

danextian_0-1745645985212.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you!

How would you adapt this measure to show green if >target, red if < target or yellow if equal to target?

Syndicate_Admin
Administrator
Administrator

Good afternoon, I hope you are well,
If I misunderstood, here's what you need
Video Help = Bing Videos
Measurements = 📊 Visual Pro Card: From Simple to Sensational in Just 4-5 Minutes - Google Docs

I hope it serves you,

Best regards

Sorry, I don;'t understand Spanish. Thanks anyway.

Oh, sorry
Check out this tutorial, it's in English
Bing Vídeos

Thank you.

Anonymous
Not applicable

Hi @Fusilier ,
Thank you @danextian  and @Syndicate_Admin  for the helpful insights!

I wanted to follow up on the previous suggestions regarding conditional formatting . We would like to hear back from you to ensure we can assist you further. If our response has addressed your query, please accept it as a solution and give a ‘Kudos’ so other members can easily find it. Please let us know if there is anything else we can do to help.

Thank you.

Regards,
Pallavi.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors