Qlik Community

Qlik Sense Cloud Discussions

chrisellis
Contributor

Set Analysis

Could someone help please , I have got so far with this but need to take it further.

The set analysis below aggregates a percentage for each subject when selected.

What I want to do is combine subjects, for example all selections of subject where the Key is the same and Level 4 or higher exist in all the subject selections for that key. The table below would give 50% because only Key A matches both criteria when Subject 1 and 2 are selected together.

(Sum(aggr(Count({$<[Level]={">=4"}>}distinct Key),PU,Subject)))/(Sum(aggr(Count(distinct Key),PU,Subject)))

KeySubjectLevelPU
ASubject 141
ASubject 251
BSubject 131
BSubject 241

Any help much appreciated.

Thanks

Chris

5 Replies

Re: Set Analysis

Is this something you want in the table or a KPI object? May be this

Sum(Aggr(If(Sum(If(Level >= 4, 1, 0)) = GetSelectedCount(Subject), 1, 0), Key, Subject))/Count(DISTINCT Key)

chrisellis
Contributor

Re: Set Analysis

Hi Sunny,

I am looking at using it in a line graph, the PU column would have more numbers in.

KeySubjectLevelPU
ASubject 141
ASubject 251
BSubject 131
BSubject 241

A

Subject 132
ASubject 242
BSubject 142
BSubject 252

Re: Set Analysis

What is the expected output here?

chrisellis
Contributor

Re: Set Analysis

PU 1 = 50%, PU 2 = 50%

Key A in PU1 Matches the criteria but PU 2 Key B Matches the criteria.

Re: Set Analysis

How about this?

Sum(Aggr(If(Sum(If(Level >= 4, 1, 0)) = GetSelectedCount(Subject), 1, 0), PU, Key, Subject))/Count(DISTINCT Key)

Community Browser