6 Replies Latest reply: Dec 22, 2016 7:45 AM by Paolo Rena

Set Analysis - Operator (+, *, /, -)

Hi to all, i have a big problem that i hope to solve it with your help....

I would like to use the "Set Analysis" operator with Bookmarks.

I have two bookmarks called Set1 and Set2.

In these bookmarks there are the results of two different selections, for example:

Set1 = Selection of product 'A'

Set2 = Selection of product 'B'

These two results sets are supposed to have some common records (customers who bought both 'A' and 'B').

I loaded the data of who bought the product (clients) and obvious the product.

These are the results I expect to get from each operator:

- Set1 + Set2 (union)

All customers who bought 'A' and all customers who bought 'B'. Duplicated records should be excluded.

- Set1 - Set2 (difference)

All customers who bought 'A' and NOT have bought 'B'

- Set1 * Set2 (intersection)

Customers who bought both 'A' and 'B'

- Set1 / Set2 (XOR)

Customers who bought 'A' XOR 'B' (customers who bought both the models are excluded).

Which is the correct syntax for these operations?

Paolo.

• Set Analysis - Operator (+, *, /, -)

I guess I don't understand the question. Your descriptions seem to be on the right track. From the look of those results, everyone who bought A, also bought B. That's why the union and intersection are the same and the difference and XOR are both 0. Is 249634 your entire dataset?

What is the Set Expression you are using? If the sets aren't working, I suppose the union and intersection could be returning every record, while the difference and XOR return nothing. I can't really tell based on the information provided.

• Re: Set Analysis - Operator (+, *, /, -)

Sorry for the image I just wanted to show the mechanism of my sheet, don't look the result of unione, intersezione, xor, differenza.

I tried to use these formulas for the union (The same formula was used for the other operators *, -, xor):

1) =count({<CLIENT=p({Set1}) + p({Set2})>}  DISTINCT CLIENT)

2) =count({Set1 + Set2}  DISTINCT CLIENT)

but in both cases the results aren't correct.

Which is the correct syntax for these operations for find the union, intersection, XOR and difference between the sets (Set1 Set2)?

Thanks a lot, Paolo.

• Re: Set Analysis - Operator (+, *, /, -)

hi,

try this count({\$<[field name]+={set1,set2}>} distinct client)--for union

count({\$<[field name]-={set2}>}distinct client)----for getting only set1

count({\$<[field name]*={set1,set2}>}distinct client) ----for intersection

count({\$<[field name]/={set1,set2}>}distinct client)------ set1 XOR set2

• Re: Set Analysis - Operator (+, *, /, -)

Hi Bhargavi,

thenak sfor your reply but my question it was made in 2011, i solved problems 5 years ago.

Thanks anyway

• Re: Set Analysis - Operator (+, *, /, -)

If that's the case, Paolo, maybe you want to close the discussion by posting your solution and/or marking your own answer as correct. That way, you'll avoid that other members continue a discussion on an issue that has been resolved for 5 years.

Thanks.

• Re: Set Analysis - Operator (+, *, /, -)

ok, thank you for the comment.

In that case the answer of Bhargavi Yangala is correct.

Thanks again