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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
Creator III
Creator III

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
Partner - Champion II
Partner - Champion II

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

OmarBenSalem
Partner - Champion II
Partner - Champion II

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 III
Creator III
Author

Hi,

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

OmarBenSalem
Partner - Champion II
Partner - Champion II

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

Capture.PNG

berryandcherry6
Creator III
Creator III
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 III
Creator III
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...