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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Abz_17
Helper I
Helper I

Conditional Formatting based on Calculation

Hi All, 

 

I need some help with conditional formatting on my report. I have 2 columns (Target & Actual - Data below) and wanted to add the following rules and give a RAG rating. 

 

if actual is less <98% of target then Red

if actual is between 98%-99.99% of target the Amber

if actual is >=100% then Green

Abz_17_0-1653565220323.png

Can someone advise then best way of doing this please? I am new to Power BI and my knowledge is very limited at the moment so a step by step tutorial would be a great help. 

 

Thanks

 

Abz

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Abz_17 

 

You can create this measure 

 

color =
VAR donated =
SUM ( 'Table'[Donated] )
VAR target =
SUM ( 'Table'[Target] )
RETURN
IF (
donated < 0.98 * target,
"#ff0000",
IF (
donated >= 0.98 * target
&& donated < 0.9999 * target,
"#FFBF00",
"#00ff7f"
)
)
 
in the visualization pane , under cell elements,
enable the backgroud color 
esha_shah2002_0-1653567613112.png

 

 and click on the "fx" to add that measure as field value in order to apply the specific colors

esha_shah2002_1-1653567650679.png

 

 

If this post helps, accept it as a solution

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Abz_17 

 

You can create this measure 

 

color =
VAR donated =
SUM ( 'Table'[Donated] )
VAR target =
SUM ( 'Table'[Target] )
RETURN
IF (
donated < 0.98 * target,
"#ff0000",
IF (
donated >= 0.98 * target
&& donated < 0.9999 * target,
"#FFBF00",
"#00ff7f"
)
)
 
in the visualization pane , under cell elements,
enable the backgroud color 
esha_shah2002_0-1653567613112.png

 

 and click on the "fx" to add that measure as field value in order to apply the specific colors

esha_shah2002_1-1653567650679.png

 

 

If this post helps, accept it as a solution

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.