Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting the same value in two fields

Hi everyone,

I have a list of about 100 values that appear in two fields. I want to be able to select one of those values and sum all Amounts if that value appears in either field. I'd also want to avoid any double-counting (if the value was present in both fields).

E.g., the data would look like:

 

Field1Field2Amounts
AB20
BC2
CA10
AA5
DF10

And if I selected "A", the red amounts would be selected. What kind of expression would I have to write to make this possible?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

This is awesome! Thank you for introducing me to P()

However, one more question - how can I create a list box for those 100 values for users to select, rather than have them search in list boxes for Field1 or Field2?

I saw a solution using "=Field1 & '-' & Field2", but that creates a combination. I would rather the list box was just

A

B

C

and their selection used your expression across Field1 and Field2.

Not applicable
Author

And another one:

- sum ONLY when selected values are BOTH in Field1 and Field2

Not applicable
Author

I noticed one problem with your solution - I actually have other fields, and making selections in them seems to affect this expression. How do I prevent that from happening?

Gysbert_Wassenaar

Create an alternate state on the General tab of the Document Properties window. Then assign the new alternate state to the straight table on the General tab of its properties window.


talk is cheap, supply exceeds demand
Not applicable
Author

Of course... thank you