Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
shyamcharan
Creator III
Creator III

Conditional Display of a value

Hi Experts,

If i have a table with two columns

A  B

X  10

Y  20

And when i try to display 10 in a text box using IF ELSE it works only when i select X in the list box.

But what i want is to display 2 values in 2 boxes.

First box should have 10 and second as 20.

I have used IF ELSE but it shows '-' at all times and shows correct only in one box when the respective Column A value 'X' or 'Y' is selected.

Sorry if it is dumb question

5 Replies
Not applicable

If I understand your question correctly, set analysis is your friend here. If you look at the expressions for the text boxes in the example, the code inside the braces tells one box to always act as if X is selected and the other to always act as if Y is, ignoring what is actually chosen.

-Mike

Anonymous
Not applicable

Hi,

You may have to use Only function with your IF condition.

=Only(If(A='X', B)) => 10

=Only(If(A='Y', B)) => 20

shyamcharan
Creator III
Creator III
Author

Thanks Michael.

I have used the similar one but it does not work for me.

Also can you please explain why we use max in the formula.

It works well with your example but not in my scenario .

Also What if I have more number of rows like A, B, C , D ....

Thanks heaps for the help.

dharmarasu
Creator
Creator

Hi,

Try this

=only({<A={'x'}>}B)

=only({<A={'y'}>}B)

Hope this helps

-Dharma

SunilChauhan
Champion II
Champion II

see the attched

Sunil Chauhan