Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Value Mapping

Hi,

I don't know how to achive the following:

if Value: 100% --> 1,0

if Value: 105% --> 1,5

if Value: 90% --> 0,5

where all above 105% should yield 1,5 and all below 90% should yield 0,5

Between min and max values there should be a linear correlation. So i think i need some kind of map here...

Any suggestions?

1 Solution

Accepted Solutions
maxgro
MVP
MVP

if(Exp1<=1, rangemax(0.5 + 5*(Exp1-0.9), 0.5),

if(Exp1>1, rangemin(1 + 10*(Exp1-1.0), 1.5),

'Error'))

1.png

SET ThousandSep=',';

SET DecimalSep='.';

Table1:

LOAD Dim1, Exp1/100 as Exp1 Inline [

Dim1, Exp1

C, 50

C1,90

C2,92

C3,95

C4,96

C5,98

D, 100

D1,101

D2,102

D3,103

D4,104

D5, 105

D6, 150

] ;

View solution in original post

6 Replies
sunny_talwar

Why not use a simple if statement?

If(Value < 0.9, 0.5, If(Value > 1.05, 1.5, 1)) as NewValue

marcus_sommer

If you have only two conditions the suggestion from sunindia is logical and simple. If you have more conditions and/or your load or gui-calculation is quite slow then it could be useful to implement a kind of lookup like these one:

pick(match(num(ceil(1.07, 0.05), '#.00', '.', ','), 0.00, ..., 1.10, .., 1.20), 0.00, ..., 0.5, ..., 1, 1.5)

- Marcus

Anonymous
Not applicable
Author

Thanks for you help sunindia, but im afraid this isnt exactly what i need.

If I do it like this, there are only three possible Values für 'NewVaule' (0.5,1 and 1.5).

If 'Value' is 1.04, 'NewValue' should be something like 1.4 and so on...

maxgro
MVP
MVP

if(Exp1<=1, rangemax(0.5 + 5*(Exp1-0.9), 0.5),

if(Exp1>1, rangemin(1 + 10*(Exp1-1.0), 1.5),

'Error'))

1.png

SET ThousandSep=',';

SET DecimalSep='.';

Table1:

LOAD Dim1, Exp1/100 as Exp1 Inline [

Dim1, Exp1

C, 50

C1,90

C2,92

C3,95

C4,96

C5,98

D, 100

D1,101

D2,102

D3,103

D4,104

D5, 105

D6, 150

] ;

MarcoWedel

Hi,

another solution could be:

=RangeMin(1.5,RangeMax(0.5,(Value-1)*5*(2+(Value<1))+1))

QlikCommunity_Thread_170202_Pic1.JPG

hope this helps

regards

Marco

Anonymous
Not applicable
Author

Hi Massimo,

thx, that did the trick!

Regards,

Phil