Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
kristof_j
Creator II
Creator II

Set analysis intersection problem

Hi

I'm having some problems with set analysis.

In my example I have 2 clients who are identical but the set analysis gives different results. So I'm guessing I'm doing something wrong 🙂

Client year has_product
A 2020 0
A 2021 1
B 2020 0
B 2021 1
C 2020 1
C 2021 0

 

I want to see how many clients jumped from 0 to 1. So client A and B.

I used the following expressions:

  • count(distinct { <year= {2020}, has_product= {0}> * <year = {2021}, has_product= {1}>} Client)
  • count(distinct {< Client= P({<year= {2020}, has_product= {0} >} Client) > * < Client= P({<year= {2021}, has_product= {1} >} Client) >} Client)

But for some reason in my model it shows 0 for some clients where it should be 1.

I  can't change the model so I need to fix this with an expression.

Any suggestions?

 

1 Solution

Accepted Solutions
MayilVahanan

Hi 

Try like below

Sum(Aggr(count(Distinct{ <year= {2020}, has_product= {0}>}Client)* Count(Distinct {<year = {2021}, has_product= {1}>} Client), Client))

MayilVahanan_0-1643362989022.png

 

Thanks & Regards,
Mayil Vahanan R

View solution in original post

2 Replies
MayilVahanan

Hi 

Try like below

Sum(Aggr(count(Distinct{ <year= {2020}, has_product= {0}>}Client)* Count(Distinct {<year = {2021}, has_product= {1}>} Client), Client))

MayilVahanan_0-1643362989022.png

 

Thanks & Regards,
Mayil Vahanan R
kristof_j
Creator II
Creator II
Author

Thx it works.
I hope it won't affect the performance too much if I write many of these expressions 🙂