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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kristof_j
Creator III
Creator III

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
Please close the thread by marking correct answer & give likes if you like the post.

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
Please close the thread by marking correct answer & give likes if you like the post.
kristof_j
Creator III
Creator III
Author

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