Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use set analysis operator(-)

Hi to all, I have broblem  that I hope to solve it with your help....

I would like to count the customer who bought specific items and not boutght specific items.

I have table like this.

customer_id, item_id

customer1,item1

customer1,item2

customer2,item1

customer2,item1

customer3,item1

customer3,item2

customer3,item3

customer4,item2

customer4,item3

customer5,item3

customer5,item3

customer6,item1

customer6,item3

And I would like to count the customer who bought item1 and not boutht item2.

The result I want is 2(customer2 and customer6).

I try the following expression, but it doesn't work.

Count({$<item_id={'item1'}> - <item_id={'item2'}>} Distinct customer_id)

Thanks for your help.

Toan

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Count({$<customer_id = p({<item_id = {'item1'}>}) * e({<item_id = {'item2'}>})>} DISTINCT customer_id)

View solution in original post

6 Replies
sunny_talwar

May be this:

Count({$<customer_id = p({<item_id = {'item1'}>}) * e({<item_id = {'item2'}>})>} DISTINCT customer_id)

florentina_doga
Partner - Creator III
Partner - Creator III

=concat({$<customer_id = p({<item_id = {'item1'}>})

- p({<item_id = {'item2'}>})

>}

DISTINCT customer_id,' ')

Not applicable
Author

I try this and it works.

Thank you for your help!

Not applicable
Author

I try this and it works.

Thank you for your help!

oknotsen
Master III
Master III

If your question is now answered, please flag the Correct Answer (via the big "Correct Answer" button near every post) and Helpful Answers (found under the Actions menu under every post).

If not, please make clear what part of this topic you still need help with .

May you live in interesting times!
Not applicable
Author

Thank you for your comment.

But I can't find "correct Answer" button near post.

Instead, I find 'Helpful Answers' button, so I flag this.