Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
NickBentley
Contributor III
Contributor III

Traffic Light Gauge within Straight Table

Hi there,

I am trying to develop traffic light gauges within a straight table that bases colours off 'Category' rather than hard coded values.

Anyone had any luck achieving this?

NickBentley_1-1744081319377.png

 

 

NickBentley_0-1744081305774.png

 

 

Labels (1)
1 Reply
SRA
Partner - Creator
Partner - Creator

Hi,

Let's try one answer. I loaded your data with :

Color:
LOAD * INLINE [
Category, Color, ValueMin
Fruit_Veg, 128994, 7
Fruit_Veg, 128993, 4
Fruit_Veg, 128992, 0
Poultry, 128994, 5
Poultry, 128993, 2
Poultry, 128992, 0
Meat, 128994, 6
Meat, 128993, 5
Meat, 128992, 0
];

// 128992 = Red bulb, 128993 = Yellow bulb, 128994 = Green bulb

data:
LOAD * INLINE [
ID, Product, Category, Qty
1, Apple, Fruit_Veg, 3
2, Apple, Fruit_Veg, 5
3, Chicken, Poultry, 6
4, Pear, Fruit_Veg, 7
5, Steak, Meat, 6
6, Steak, Meat, 2
7, Steak, Meat, 3
8, Duck, Poultry, 9
9, Chicken, Poultry, 3
10, Chicken, Poultry, 2
];

Is this what you are trying to achieve ?

SRA_1-1744099267173.png

Quantity measure is :

=Sum(Qty)

Traffic light measure is :

=If(Sum(Qty)<FirstSortedValue(ValueMin,ValueMin,2), Chr(FirstSortedValue(Color,ValueMin,1)),
If(Sum(Qty)<FirstSortedValue(ValueMin,ValueMin,3), Chr(FirstSortedValue(Color,ValueMin,2)), Chr(FirstSortedValue(Color,ValueMin,3))))

I hope this answer will help you. If yes you can tick the answer as a solution.

Thanks