Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

count(DISTINCT (x)) + Set analysis + if

Hello Community

this is my database:

contract_nocontract_payments_perccontract_term_type
13,11%0
12,40%1
11,5%2
22,4%0
21,7%1
21,0%2
32,8%0
32,8%1
32,8%2

What I want to do is

QV should count DISTINCT each contract_no where contract_payments_perc is equal to the other contract_payments_perc position inside the same contract_no.

Example:

1. Look up for contract_no = 1 AND contract_term_type = 0 AND the referring contract_payments_perc = 3,11%

2. Compare contract_payments_perc = 3,11 % with contract_payment_perc where contract_term_type = 1 AND 2 (2,4%, 1,5%)

3. if its equal, count distinct contract_no

4. in this case, it is not equal

5. result count(DISTINCT contract_no) = 0

I tried this

count(DISTINCT if(   sum({$<contract_term_type = {'0'}> contract_payments_perc)    =    sum({$<contract_term_type = {'>0'}> contract_payments_perc), contract_no ))

Unfortunetly is does not work.

Hope someone can help me out here

0 Replies