Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis - Intersection exclusion.

Hi, everyone. I'm quite new to QV. I have the following question:

I have accounts, and sub-accounts. Various sub-accounts per account:

Account - Subaccount - Money

2601 - 001 - $500

2601 - 002 - $400

2602 - 001 - $900

2602 - 002 - $1000

2602 - 003 - $300

How can I say, via set analysis "I want the sum of money from every account and sub-account EXCEPT from account  = {2601} & subaccount = {001}, and account = {2602} & subaccounts = {001,003} ? Meaning I would be excluding $500 from account 2601, and $900 and $300 from account 2602.

Thanks in advance!

Martín.

1 Solution

Accepted Solutions
Nicole-Smith

The following two expressions both worked for me:

=sum({$<Subaccount=E({1<Account={2601},Subaccount={'001'}>}Subaccount)>*<Subaccount=E({1<Account={2602},Subaccount={'001','003'}>}Subaccount)>} Money)

and

=sum({$-(<Account={2601},Subaccount={'001'}>/<Account={2602},Subaccount={'001','003'}>)}Money)

You can see them in action in the text boxes in the attached .qvw file.

View solution in original post

5 Replies
Nicole-Smith

The following two expressions both worked for me:

=sum({$<Subaccount=E({1<Account={2601},Subaccount={'001'}>}Subaccount)>*<Subaccount=E({1<Account={2602},Subaccount={'001','003'}>}Subaccount)>} Money)

and

=sum({$-(<Account={2601},Subaccount={'001'}>/<Account={2602},Subaccount={'001','003'}>)}Money)

You can see them in action in the text boxes in the attached .qvw file.

Not applicable
Author

sum({$-1(<Account={2601},Subaccount={'001'}>/<Account={2602},Subaccount={'001','003'}>)}Money)

Not applicable
Author

You are a genius, Nicole Smith. That E() function there (which I did not know about) changed my life forever. Thank you very much!

Nicole-Smith

I'm glad it was helpful!

Not applicable
Author

Thank you too, Asim! I had to remove '-1' from '$-1', but aside from that (and it might be my fault) your answer helped me too. Thanks again!