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
Syndicate_Admin
Administrator
Administrator

Power BI - Add background color in matrix table based on condition

Hi I need help on how can I add background color in my matrix table based on condition. 

The condition is:

1. Those who get at least 12 and above in total, the background color should be green (total >= 12, background color=green, else will stay as default color)

2. The green background color is ONLY applicable for those who took AT LEAST 1 for Health Screening pillar

3. The end result should be like this: (total >= 12, background color=green, ONLY IF 1 Health Screening has been taken)

 

Refer to my screenshot below:

 

Is it possible to do this in Power BI Desktop? If yes, can you teach me how to do this.

Thanks in advance!

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Syndicate_Admin 

 

If it's a matrix visual, you can create the following measure for the background color. When setting the background color, select Format style "Field value" based on this measure and apply it to "Totals only". 

BG Color = IF(SUM('Table'[Value])>=12 && CALCULATE(SUM('Table'[Value]),'Table'[Category]="Health Screening")>=1, "#00FF00")

vjingzhang_0-1660642322207.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Syndicate_Admin 

 

If it's a matrix visual, you can create the following measure for the background color. When setting the background color, select Format style "Field value" based on this measure and apply it to "Totals only". 

BG Color = IF(SUM('Table'[Value])>=12 && CALCULATE(SUM('Table'[Value]),'Table'[Category]="Health Screening")>=1, "#00FF00")

vjingzhang_0-1660642322207.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hi @Syndicate_Admin , I have a question. Based on my previous question and your solution, is it possible if I want to count the total green?

Hi @Syndicate_Admin , I tried this method and it works!! Really appreciate your assistance. Thank you so much and hope you have a good day! 🙂

Syndicate_Admin
Administrator
Administrator

Hi Nbz78,

 

I think this post will help in solving your problem.

 

Let me know if I can provide you with more details

 

Thanks

Regards,


Abdul Wahab
Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
Direct/WhatsApp:+923323281237
E-mail: abdulwahabubit@outlook.com
Skype: abdul.wahabubit
Linkedin: https://www.linkedin.com/in/abdul-wahab-a5b8b011a/

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.

Top Solution Authors