Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
loyarcec
Contributor II
Contributor II

Count distinct of two fields combined

Hi,

  I have one table and I am trying to do something like this:

Count(DISTINCT{$<[TIPO_MOVIMENTO]={1},[COD_OPER]={10,11,12,13},[COD_COSSEG_RESSEG]={'null'},[DT_ABERT]={'>=$(=Date(vPeriodStart))<=$(=Date(vPeriodEnd))'}>} [NUMSINOFICIAL])

+

Count(DISTINCT{$<[TIPO_MOVIMENTO]={0},[COD_OPER]={1,2},[COD_COSSEG_RESSEG]={'null'},[DT_MOVTO]={'>=$(=Date(vPeriodStart))<=$(=Date(vPeriodEnd))'}>} [NUMSINOFICIAL])

Expression 1 and expression 2 have different filters but are based on the same table. In the second line, I  want to count all the NUMSINOFICIAL that are not in the first one.I have been trying including [NUMSINOFICIAL]-=P([NUMSINOFICIAL]) in the second expression, but due to they are the same it is not working.

Any ideas?.... thanks.

3 Replies
Anil_Babu_Samineni

Not really sure, What you meant. But, Try a luck

Count(DISTINCT{$<[TIPO_MOVIMENTO]={1},[COD_OPER]={10,11,12,13},[COD_COSSEG_RESSEG]={'null'},[DT_ABERT]={'>=$(=Date(vPeriodStart))<=$(=Date(vPeriodEnd))'}>} [NUMSINOFICIAL])

+

Count(DISTINCT{$<[TIPO_MOVIMENTO]={0},[COD_OPER]={1,2},[COD_COSSEG_RESSEG]={'null'},[DT_MOVTO]={'>=$(=Date(vPeriodStart))<=$(=Date(vPeriodEnd))'}, NUMSINOFICIAL = E({<[TIPO_MOVIMENTO]={0},[COD_OPER]={1,2},[COD_COSSEG_RESSEG]={'null'},[DT_MOVTO]={'>=$(=Date(vPeriodStart))<=$(=Date(vPeriodEnd))'}>} NUMSINOFICIAL)>} [NUMSINOFICIAL])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Or may be this

Count(DISTINCT{$<[TIPO_MOVIMENTO]={1},[COD_OPER]={10,11,12,13},[COD_COSSEG_RESSEG]={'null'},[DT_ABERT]={'>=$(=Date(vPeriodStart))<=$(=Date(vPeriodEnd))'}>+<[TIPO_MOVIMENTO]={0},[COD_OPER]={1,2},[COD_COSSEG_RESSEG]={'null'},[DT_MOVTO]={'>=$(=Date(vPeriodStart))<=$(=Date(vPeriodEnd))'}>} [NUMSINOFICIAL])

pradosh_thakur
Master II
Master II

why not write both the expression separately in a straight table and see if both are working and you are getting the sum ?

try it and tell us where it went wrong.

regards

Pradosh

Learning never stops.