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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
cliff_clayman
Creator II
Creator II

How do I exclude values from a List Box using Alternate States?

I have two list boxes with the same dimension.  When I make a selection in the first list box, I do not want that same value available for selection in the second list box.  How can I do this?

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=Aggr(If(GetSelectedCount(ProductName, False(),'Group1') = 0, ProductName, Only({1<ProductName = e({Group1} ProductName)>} ProductName)), ProductName)

View solution in original post

13 Replies
sunny_talwar

Try this

List Box 1

FieldName

List Box 2

Aggr(Only({1<FieldName = p(FieldName)>}FieldName), FieldName)

cliff_clayman
Creator II
Creator II
Author

Capture.JPG

That doesn't seem to work right for me.  In the above example, I chose AAA Running Shoe.  I do not want to be able to select the same value in the second list box.

sunny_talwar

Is this not working?

Aggr(Only({1<ProductName = e(ProductName)>}ProductName), ProductName)

Apologizes, so are you using two states for this?

cliff_clayman
Creator II
Creator II
Author

Yes, I apologize for not making that clear.  I called them Group1 and Group2.  I just don't want to be able to compare the same product to each other in the chart.

sunny_talwar

I have not tested this, but try this

ProductName -> Group1

Aggr(Only({1<ProductName = e({Group1} ProductName)>} ProductName), ProductName) -> Group2

cliff_clayman
Creator II
Creator II
Author

It somewhat works.  The second list box starts out without any values and somehow when nothing is selected in the second list box, I still get some dollar values in the chart.

sunny_talwar

Try this:

=Aggr(If(GetSelectedCount(ProductName, False(),'Group1') = 0, ProductName, Only({1<ProductName = e({Group1} ProductName)>} ProductName)), ProductName)

cliff_clayman
Creator II
Creator II
Author

Yeah, that seems to work!  Can you explain what the expression is doing exactly?

sunny_talwar

When nothing is selected then show ProductName

=Aggr(If(GetSelectedCount(ProductName, False(),'Group1') = 0, ProductName, Only({1<ProductName = e({Group1} ProductName)>} ProductName)), ProductName)

When a ProductName is selected in Group1, then exclude whatever is selected in Group1's productname field

=Aggr(If(GetSelectedCount(ProductName, False(),'Group1') = 0, ProductName, Only({1<ProductName = e({Group1} ProductName)>} ProductName)), ProductName)