Forum Discussion

andreazambon's avatar
andreazambon
Helper V
2 years ago
Solved

Advance conditional formatting with limits

Hi there. 

Suppose to have:

  • a measure used to calculate the material consuption of some row materials. 
  • a measure that calculates the inferior limit (min) for the theorical consumption;
  • a measure that calculates the major limit (max) for the theorical consumption.

All these information are shown in a table with the id of my materials.

In this scenario, we have a min-max range and a value for the actual consumption of my raw materials.

It's quite simple to put a measure to map the conditional formatting of a field: if the consumption is higher than the max -->green; if is lower than the min --> red.

 

What about a third rule applied if the value is inside the range? In this case i'd like to have a gradient from green to red.

Possible?

  • I do not think you are able to "stack" conditional formatting. In your case you may be able to get around this by using a measure that feeds into the custom values in the gradient formatting. 
    As a small example, here is a list of numbers 1-20. I would like everything below my dynamic minimum value to be red, everything above my dynamic max value to be green and everything in between to be gradient.

    I could write a measure as follows that accepts my min and max measures and assigns any value in my list that is below(equal) to the min as 0 and anything that is above(equal) to the max as 1. The measure then calculates a percentage of max value for the remaining values that will give the selected value a value between 0 and 1. You can then set the custom values of the gradient as 0 and 1.



     

    This is a bit of a wonky workaround, but it might work for you.

1 Reply

  • I do not think you are able to "stack" conditional formatting. In your case you may be able to get around this by using a measure that feeds into the custom values in the gradient formatting. 
    As a small example, here is a list of numbers 1-20. I would like everything below my dynamic minimum value to be red, everything above my dynamic max value to be green and everything in between to be gradient.

    I could write a measure as follows that accepts my min and max measures and assigns any value in my list that is below(equal) to the min as 0 and anything that is above(equal) to the max as 1. The measure then calculates a percentage of max value for the remaining values that will give the selected value a value between 0 and 1. You can then set the custom values of the gradient as 0 and 1.



     

    This is a bit of a wonky workaround, but it might work for you.