8 Replies Latest reply: Apr 14, 2017 8:05 AM by Robin Hausdörfer

# Expression for dynamic values in qlik

Hi,

i have a table like below

Table1:

Country, rank

Malasia,1

Goa,5

Germany,6

Korea,4 ];

i need a expression where it compares rank of country, i.e if rank of Country = 1, "I am in Malaysia", if rank of Country = 5, "I am in Goa"....

What should be my express here?

• ###### Re: Expression for dynamic values in qlik

You want to create a new field which will have value 'I am in Malaysia', 'I am in Goa' and so on?

• ###### Re: Expression for dynamic values in qlik

Like this?

If so, do as follow:

Table1:

load*, 'I am in '&Country as " Where am I?" ;

Country, rank

Malasia,1

Goa,5

Germany,6

Korea,4 ];

• ###### Re: Expression for dynamic values in qlik

Hi,

I want to display it in textbox, if i select on filters.

• ###### Re: Expression for dynamic values in qlik

Just add the new field "Where am I" as a measure in a text box:

• ###### Re: Expression for dynamic values in qlik

What if i am using chart, if country's are dynamically changing. and so rank. Then i need to put in expression (Filter is not used)

if(rank of country = 1,rgb(23,54,2),

if(rank of country = 2,rgb(12,45,32),

if(rank of country = 3,rgb(11,76,3))

How should be my expression?

• ###### Re: Expression for dynamic values in qlik

like that?:

if(rank(total [rank of country],4) = 1,rgb(23,54,2),

if(rank(total [rank of country],4) = 2,rgb(12,45,32),

if(rank(total [rank of country],4) = 3,rgb(11,76,3)

)))

• ###### Re: Expression for dynamic values in qlik

hmm, partially.

Here goes two point

1.) What is rank of country  here?

2.) i want to take rank mentioned in column and compare with it. Not the row rank . because i dont be knowing how many rows are there in column. It is dynamic

• ###### Re: Expression for dynamic values in qlik

I thought [rank of country] is a field?!?

try:

if(rank([rank],4) = 1,rgb(23,54,2),

if(rank([rank],4) = 2,rgb(12,45,32),

if(rank([rank],4) = 3,rgb(11,76,3)

)))

Try it with and without total, ... it depends...