3 Replies Latest reply on Aug 29, 2016 2:27 PM by Yuriy Fal

    Dynamic Measure Coloring

    victor chan

      Thanks in advance for reading this.


      I have an interesting problem where I have all a column of different benchmarks. Each measure value corresponds to a measure metric. I am trying to create a bar chart with colored bars where the better value is a darker color. The problem I am having is a specific measure will have a different interpretation. In this (kitchen themed) dataset there are two. Cycles/day and Time to Finish. In Time to Finish's case, a smaller number is better and should correspond to a darker colored bar in the bar chart. In the case of the Cycles/day metric, a larger number should be a darker colored car.


      How I was able to color the difference between dishwashers and stoves was making one negative and then step the colors. (Please see sample dataset)

      But getting this to dynamically invert with a "bigger is better" flag has not been fruitful. I did this by utilizing the window_sum() and sum() function. But it makes the smallest value 0 which wouldn't work.


      I'm hoping this is an easy fix, links to other threads where this has come up is welcome. Any ideas or strategy to solve this is greatly appreciated.





      Below: Is an example of my attempt. The second bar from the left should be darker than the left most bar. To invert, I can take the sum(metric Value) - window_min(sum([metric_value]) but this will make the leftmost bar 0 when it should be greater than 0 so that the bar does not turn 0.