Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Creating a guage from text field

I have a field with 5 possible text values -

Far ahead

Ahead

On track

Behind

Far behind

I would like to create a traffic light gauge with a colour for each of the five values e.g. red for 'far behind', green for 'far ahead' etc.  How do I do this?

Thanks

Greg

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Match does not allow for set analysis.

You can try using the only function inside:

pick(match(only({<FIELD2 = {'x'}>}FIELD), 'Far ahead', 'Ahead', 'On track', 'Behind', 'Far behind'), 5, 4, 3, 2, 1)


Hope this helps!

View solution in original post

10 Replies
datanibbler
Champion
Champion

Hi Greg,

I assume that field is the result of a calculation?

Just create a traffic light gauge and assign five segments to it - untick the checkboxes at the bottom, then you can assign a starting_value for each segment. They need not necessarily be equally distributed, but since you have five values, that seems the easiest.

The only problem is, you cannot assign text_values to those segments, so you need to map them with numeric values - you can do that via a mapping table and the ApplyMap() command.

ashfaq_haseeb
Champion III
Champion III

Hi,

May be like this.

Regards

ASHFAQ

Anonymous
Not applicable
Author

Thanks for your response.

The field is the result of management judgement rather than a calculation.

I am not familiar with mapping tables or the ApplyMap() command.  Would you be willing to supply an example?

Thanks

Greg

jerem1234
Specialist II
Specialist II

You can always use pick(match()). Then just use different segments for what you want. For example:

pick(match(FIELD, 'Far ahead', 'Ahead', 'On track', 'Behind', 'Far behind'), 5, 4, 3, 2, 1)


Hope this helps!

ashfaq_haseeb
Champion III
Champion III

Hi,

Have you look at my application.

Regards

ASHFAQ

Anonymous
Not applicable
Author

Thanks.  How would I apply your expression to work out a traffic light value for each of the areas in the following data:

Fields.bmp

Greg

Not applicable
Author

YOU MEAN THIS?

You can always use pick(match()). Then just use different segments for what you want. For example:

pick(match(FIELD, 'Far ahead', 'Ahead', 'On track', 'Behind', 'Far behind'), 5, 4, 3, 2, 1)


Hope this helps!

Anonymous
Not applicable
Author

OK. So this applies a numeric value to the FIELD values and I can now get the gauge to work nicely. Thanks!

How do I introduce another field into the expression? e.g.

pick(match(([$<OTHERFIELD={'x'}>} FIELD, 'Far ahead', 'Ahead', 'On track', 'Behind', 'Far behind'), 5, 4, 3, 2, 1))

But this doesn't work.

Thanks

Greg

jerem1234
Specialist II
Specialist II

Match does not allow for set analysis.

You can try using the only function inside:

pick(match(only({<FIELD2 = {'x'}>}FIELD), 'Far ahead', 'Ahead', 'On track', 'Behind', 'Far behind'), 5, 4, 3, 2, 1)


Hope this helps!