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

Expression help for Conditional Show/Hide

Hi,

I have two charts superimposed and at any time I need to show only one of them.

The condition determining which one should appear is determined by column Company having only 3 values A, B and C.

I have a list box that is used to filter on one or more values among the three.

When nothing is selected or when C is selected Chart 1 shows

Expression:

if(Company = 'A' OR Company = 'B'  OR (Company = 'A' AND Company = 'B'),0,1)

Alternatively I have also tried this

if(Company = 'A' OR Company = 'B' ,0,

if(Company = 'C',1 ))

When A or B or Both A and B are selected Chart 2 should show

if(Company = 'A' OR Company = 'B',1 ,

if(Company = 'A' AND Company = 'B' ,1,0 ))

Now when I select either A or B Chart 2 shows up but when I select both A and B, chart 1 shows up.

What am I doing wrong?

Any help would be highly appreciated.

Thanks,

AM

1 Solution

Accepted Solutions
MayilVahanan

HI

=if(match(GetFieldSelections(Company),'A','B','A, B'),1,0)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

5 Replies
MayilVahanan

HI

=if(match(GetFieldSelections(Company),'A','B','A, B'),1,0)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

When you have only one Company selected Company will equal the selection, but if you have both selected, it will yield a null value.  Instead use Match() on GetFieldSelection(). Does that make sense?

Not applicable
Author

Thanks Mayil and Rebecca. It worked.

Not applicable
Author

Hi,

I am having a similar issue. I want to a chart to display only if a single value within a specific column has been selected. I would have thought that the following should work:

=IF(COUNT(DISTINCT(ProcessStage))=1,1,0)

If I put this into a text box it does display 0 when it shouldn't be visible and 1 when it should be. However when I put it into the "show conditional" field of the graph it no longer works.

Any ideas anyone?

Not applicable
Author

Daniel - for your issue it sounds like it would be better to use If(GetSelectedCount(FieldName)=1,1,0) for your conditional field.