Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
Creator II
Creator II

Expression for dynamic values in qlik

Hi,

i have a table like below

Table1:

Load * Inline [

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?

8 Replies
OmarBenSalem

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

OmarBenSalem

Like this?

Capture.PNG

If so, do as follow:

Table1:

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

Load * Inline [

Country, rank

Malasia,1

Goa,5

Germany,6

Korea,4 ];

berryandcherry6
Creator II
Creator II
Author

Hi,

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

OmarBenSalem

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

Capture.PNG

berryandcherry6
Creator II
Creator II
Author

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?

Anonymous
Not applicable

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)

)))

berryandcherry6
Creator II
Creator II
Author

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

Anonymous
Not applicable

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...