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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Shefkat
Contributor
Contributor

how to convert percentage range field to numerical field

How can I convert a given " <0,05%" field to a numerical field. e.g. If xx field is given as " <0,05%" write it in the graph as 1

if a given field is "0.05 < 0.25 %" write it as 2

if a given field is "0.25 < 0.5 %" write it as 3 etc.

 

It is difficult to plot in a graph field given in percentage range therefore i need to convert these into some other numerical or textual category. thanks.

Labels (1)
2 Replies
Or
MVP
MVP

If(Field = 'Value1',1,If(Field='Value2',2,3))

or for a more robust approach,

Match(Field,'Value1','Value2','Value3')

You can also use Pick(Match()) if you want the descriptions to be something other than 1, 2, 3 etc.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I would consider using a Mapping table in the script to generate a new field in the script.

https://help.qlik.com/en-US/sense/November2022/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPref...

This would also allow you to use a Dual() on the x-axis. 

Dual(oldfield, newfield)

Using Dual means the axis points will use the newfield values, but the axis  labels will be the oldfield values. 

-Rob