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
Anonymous
Not applicable

Conditional Formatting for a measure values

Hello All,


I really need urgent help in conditional formatting (Background)

I have a matrix visual which shows 2 categories and based on that I have calculated change 
sales price,count,avg and Change all are measures

PDRC_123_0-1679380368884.png

on Change I have to apply the background color based on below condition
If values in the change <  -50%  then dark red
-50% to 0% should be red
0% to 50% green
> 50% dark green

what I have done

I was not able to apply on negative % to I started with positive

if value >0(percent)  and <= then 50(percent) dark green
if value >50(percent)  and <= then 100 (percent) green  

still with the above logic, it is not formatting the values
Please let me know how can I add those buckets





1 ACCEPTED SOLUTION
SamInogic
Super User
Super User

Hi @Anonymous , 

 

As per our Understandings you are looking for Background color change on Measure witch if else Condition 

 

This is My Sample table:
Sample Table.png

You can achieve this by Creating a column Using Below DAX Expression and using it in Conditional Formatting.

 

ColorColumn =

 

var percentageValue = [% Percentage]

 

var DarkRed =

"#8b0000"

 

var red =

"#FF0000"

 

var green =

"#00ff00"

 

var darkGreen =

"#006600"

 

return

IF(percentageValue> 0 && percentageValue <

1, DarkRed,IF(percentageValue>1 && percentageValue<5, red,IF(percentageValue>5

 && percentageValue <45 , green,IF(percentageValue>45,darkGreen))))

color.png

Now Just use this color Column in conditional Formatting

formatting.png

Choose the Colour Column :

background color.png

 

This will give below result:

output.png
If possible you can provide us a sample pbix report with your data structure, so we can check and help you to achieve this in your report as well.

 

If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.


Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello @SamInogic 

Thank you so much for the help I really appreciate that you helped me this fast.

Just want to confirm that power does not support conditional formatting for negative percentages right?

PDRC_123_0-1679385629630.png

because it is giving me an error saying logical error. I know you have told me the workaround way. But just want to clarify.


And once again Thank you so much for all the help.

Hi @Anonymous 

Yes, we cannot use negative values when there's a percent is selected to the Rule, However you can try this with Number,
percent error.png

Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

 

SamInogic
Super User
Super User

Hi @Anonymous , 

 

As per our Understandings you are looking for Background color change on Measure witch if else Condition 

 

This is My Sample table:
Sample Table.png

You can achieve this by Creating a column Using Below DAX Expression and using it in Conditional Formatting.

 

ColorColumn =

 

var percentageValue = [% Percentage]

 

var DarkRed =

"#8b0000"

 

var red =

"#FF0000"

 

var green =

"#00ff00"

 

var darkGreen =

"#006600"

 

return

IF(percentageValue> 0 && percentageValue <

1, DarkRed,IF(percentageValue>1 && percentageValue<5, red,IF(percentageValue>5

 && percentageValue <45 , green,IF(percentageValue>45,darkGreen))))

color.png

Now Just use this color Column in conditional Formatting

formatting.png

Choose the Colour Column :

background color.png

 

This will give below result:

output.png
If possible you can provide us a sample pbix report with your data structure, so we can check and help you to achieve this in your report as well.

 

If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.


Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

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.