Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
kennethand
Contributor III
Contributor III

Sum with exclude and include using set analysis

I have a datafile looking like this (just a snip):

 

IDWeightProduct
11,29A
11,29B
20,64A
32,65A
32,65B
32,65C
40,50C
51,00A
51,00C
61,02A
70,64A
70,64B
70,64C
80,76A
91,29A
91,29B
91,29C
100,72A
111,02C
120,86A
120,86C

 

Now I like to calculate how many percent has choosed Product=A but not B and C.

I have to sum the weight but only distinct ID and then divide with the total sum of total weight (also distinct iD). I know to measure the last part:

sum(aggr(sum(DISTINCT Weight), [ID]))

 

But how do I calculate how many has choosed Product=A but not B and C?

 

In this example only ID 8 and 10 has choosed A and not B and C and their sum of weight is 1.48 (0.76+0.72). So the the precent will be 12% (1.48 / 12.37).

1 Solution

Accepted Solutions
y_grynechko
Creator III
Creator III

Hey, E() allows you to exclude the ones that never had B or C assigned. 

Capture.PNG

View solution in original post

1 Reply
y_grynechko
Creator III
Creator III

Hey, E() allows you to exclude the ones that never had B or C assigned. 

Capture.PNG