Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

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

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





  • Hi Anonymous , 

     

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

     

    This is My Sample table:

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

    Now Just use this color Column in conditional Formatting

    Choose the Colour Column :

     

    This will give below result:


    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 [email protected]

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

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

3 Replies

  • Hi Anonymous , 

     

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

     

    This is My Sample table:

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

    Now Just use this color Column in conditional Formatting

    Choose the Colour Column :

     

    This will give below result:


    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 [email protected]

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

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

  • Anonymous's avatar
    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?

    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.

    • SamInogic's avatar
      SamInogic
      Super User

      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,

      Thanks!

      Inogic Professional Service Division

      An expert technical extension for your techno-functional business needs

      Power Platform/Dynamics 365 CRM

      Drop an email at [email protected]

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

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