Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jduluc12
Creator
Creator

set analysis operator question

Hi,

Here is my data set.

CustomerProductAmount
CustAProd_1100
CustBProd_2200
CustCProd_1300
CustCProd_3100
CustDProd_120
CustEProd_1200
CustFProd_1100
CustFProd_4100
CustGProd_3400

I need to write an expression something like this

sum ({<Customer={'CustA', 'CustB', 'CustF', 'CustC', 'CustD'}> - <Customer=p({<Product={'Prod2', 'Prod3'}>})>}Amount)

it should return amount of CustA and CustD becasue only these two customers in the first list(in red)  have not bought Prod2 and Prod3.

It should not return amount of CustE even though it also have bought Prod2 and Prod3 because it is not in the first list(in red)

The intention is to choose only those customers who are in first list (in red) and those who have not bought products mentioned in  the second list (in green).

1 Solution

Accepted Solutions
sunny_talwar

Why not include CustF? He hasn't bouth Prod2 or Prod3... may be this

Sum({<Customer={'CustA', 'CustB', 'CustF', 'CustC', 'CustD'}-p({<Product={'Prod_2', 'Prod_3'}>})>}Amount)

View solution in original post

2 Replies
sunny_talwar

Why not include CustF? He hasn't bouth Prod2 or Prod3... may be this

Sum({<Customer={'CustA', 'CustB', 'CustF', 'CustC', 'CustD'}-p({<Product={'Prod_2', 'Prod_3'}>})>}Amount)

jduluc12
Creator
Creator
Author

You are right.

In fact even my expression worked but yours is more elegant.