Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
byrnel0586
Creator
Creator

Traffic Light Gauge Lower Bounds

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!

5 Replies
erjohnso
Creator
Creator

See if this helps. I loaded simple, dummy data and created a 5 scale stoplight chart based on an average rating.

johnw
Champion III
Champion III

Traffic light, autowidth segments, min 0 to max 5, seems to work as intended.

johnw
Champion III
Champion III

Also seems to work when done with the settings you seem to be saying you used.

byrnel0586
Creator
Creator
Author

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

johnw
Champion III
Champion III

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.