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

Conditional formatting matrix percent of row total

When creating a Matrix visual , I would like to know the percentage of recharge per resource. In my Data these values are hours (whole numbers). In the Matrix I turn these hours into percent of row total to have percentage values per resource. After doing that I can't conditional format on these percentages. (see screenshot). I would like to have red color when Yes value is below 86% and green if 86% or above. Someone here who has a bypass for that via some code?

 

Someone already have added this as idea to solve in next updates if voted enough Smiley Happy

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/14475942-conditional-formatting-f...

 

Matrix visual.PNG

1 ACCEPTED SOLUTION
bidevsugmen
Resolver I
Resolver I

Hi @mdebekke

 

Why don't you try creating measures as I have mentioned below for Yes % and No %.

 

1. Create measures

Yes % = CALCULATE(SUM(Table[YesHours])/(SUM(Table[YesHours]) + SUM(Table[NoHours])))

No % = CALCULATE(SUM(Table[NoHours])/(SUM(Table[YesHours]) + SUM(Table[NoHours])))

 

2. Convert datatype of these measures to % using the modelling tabimage.png

3. Use the measures in the matrix as in the above screenshot

 

4. You can use conditional formatting property available for matrix and set the color for any column as per the range conditionsimage.png

This should serve your purpose!

Do try this approach and accept as solution if it works..and let me know in case of any queries! 

 

 

 

Thanks,

Suguna.

View solution in original post

2 REPLIES 2
bidevsugmen
Resolver I
Resolver I

Hi @mdebekke

 

Why don't you try creating measures as I have mentioned below for Yes % and No %.

 

1. Create measures

Yes % = CALCULATE(SUM(Table[YesHours])/(SUM(Table[YesHours]) + SUM(Table[NoHours])))

No % = CALCULATE(SUM(Table[NoHours])/(SUM(Table[YesHours]) + SUM(Table[NoHours])))

 

2. Convert datatype of these measures to % using the modelling tabimage.png

3. Use the measures in the matrix as in the above screenshot

 

4. You can use conditional formatting property available for matrix and set the color for any column as per the range conditionsimage.png

This should serve your purpose!

Do try this approach and accept as solution if it works..and let me know in case of any queries! 

 

 

 

Thanks,

Suguna.

To solve this to get the measures into my file I created 2 custom columns via "edit queries" with below formula, because I had 1 hours column:

 

=  if Text.Contains([RECHARGE], "YES") then [Hours] else 0)

=  if Text.Contains([RECHARGE], "NO") then [Hours] else 0)

 

This solved combined with your solution my challenge 🙂

 

Thanks!!!

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.