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
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
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.