Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am trying to create a traffic light indicator based on a 5-star value. For instance, I want values 4-5 to show as green, 2-3 as yellow, and 0-1 as red. I am having trouble figuring out what values to put as the lower bounds to make this happen. I currently have the min value setting as 0 and the max as 5. I have 3 segments, green's lower bound set to 4, yellow set to 2, and red set to 0. This is not giving me my desired results.
Can someone please help? Thanks!
See if this helps. I loaded simple, dummy data and created a 5 scale stoplight chart based on an average rating.
Traffic light, autowidth segments, min 0 to max 5, seems to work as intended.
Also seems to work when done with the settings you seem to be saying you used.
Thanks, John. I thought my logic was correct but I'm not getting the correct results. Could it be because I'm using an expression to determine the value? And the value is likely not going to be a single digit, but rather a decimal. Please see my expression to determine the star's value below. Do I need to use a rounding function?
SUM(Aggr(
$(vStarWeight) * Only(Weight)
,Star,_MeasureYearKey,County))
/
SUM( Weight)
You could try round(), floor(), or ceil() if any of those are appropriate. With the autowidth segments, I have problems with some fractional values, but it seems to work fine for the segments with the specified starting points. But I can imagine cases where you might have 3.999999999 for instance, and since it's below 4, it still shows yellow, even though it displays on the screen as 4 to any reasonable number of digits.