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
jmuthukumaran
Frequent Visitor

Background color based on another row

Team , 

 

I have a matrix report , i need to add background color to "CFR Total" row based on "Target %" row ,something like this 

if target % is less than CFR Total for that period then Green else Red.i tried multiple ways but i couldnt get this , kidnly help

 

Report View:

jmuthukumaran_0-1649311590556.png

 

Table data :

jmuthukumaran_1-1649311931434.png

 

 

6 REPLIES 6
V-lianl-msft
Community Support
Community Support

Hi @jmuthukumaran ,


Please try to create measure like below:

Measure2 = 
var target_ = CALCULATE(SUM('test'[Value]),FILTER(ALL('test'),'test'[Period]=SELECTEDVALUE('test'[Period])&&'test'[Details]="Target %"))
Var total_ =CALCULATE(SUM('test'[Value]),FILTER(ALL('test'),'test'[Period]=SELECTEDVALUE('test'[Period])&&'test'[Details]="Total"))
return IF(target_<total_,"green","red")

Vlianlmsft_1-1649660180038.png

 

Vlianlmsft_0-1649660158921.png

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the reply , if i have multiple countries in column A like China , India etc 

jmuthukumaran_0-1649737899618.png

does measure logic change ?

Hi @jmuthukumaran ,

 

Add the country condition in filter:

Measure2 = 
var target_ = CALCULATE(SUM('test'[Value]),FILTER(ALL('test'),'test'[Period]=SELECTEDVALUE('test'[Period])&&'test'[Details]="Target %"&&'test'[country]=SELECTEDVALUE('test'[country])))
Var total_ =CALCULATE(SUM('test'[Value]),FILTER(ALL('test'),'test'[Period]=SELECTEDVALUE('test'[Period])&&'test'[Details]="Total"&&'test'[country]=SELECTEDVALUE('test'[country])))
return IF(target_<total_,"green","red")


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PC2790
Community Champion
Community Champion

Hey @jmuthukumaran ,

 

See if this helps

amitchandak
Super User
Super User

@jmuthukumaran , You can create a color measure and use that in conditional formatting using field value option

 

if([Target %]< [CFR Total], "Green", "Red")

 

How to do conditional formatting by measure and apply it on pie? : https://youtu.be/RqBb5eBf_I4

Thanks for the quick response , in my case [Target %] and [CFR Total] are present as row values not as a column name refer 2nd screenshot for data view,  

this condition  if([Target %]< [CFR Total], "Green", "Red") is not working 

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.