Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rnepla83
Partner - Creator
Partner - Creator

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'

Immagin0e.png

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?

Thanks for your help.

Paolo.



1 Solution

Accepted Solutions
Not applicable

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

View solution in original post

6 Replies
Not applicable

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.

rnepla83
Partner - Creator
Partner - Creator
Author

Hey NMiller, thanks for your reply.

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)?

Immagine.png

Thanks a lot, Paolo.

Not applicable

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

rnepla83
Partner - Creator
Partner - Creator
Author

Hi Bhargavi,

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

Thanks anyway

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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.

rnepla83
Partner - Creator
Partner - Creator
Author

ok, thank you for the comment.

In that case the answer of bhargaviy10 is correct.

Thanks again