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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Combining 2 COUNT statements with different Dimension values?

Hello,

I'm trying to combine 2 COUNT statements that have unique Dimension values.  I need these to be aggregated, not added.  So if either of the two Count statements have some of the same value, that value only gets counted once.

Here are the 2 statements..... Notice that they have some similar Dimension values (Year, Code04), but then some different (Code01,Code02,Code03)

I tried putting an 'OR' between them, but just got -1 as the result. 

Any ideas??

Count( {$<Year = {$(=max(MaxYear))}, Code1 = {'Value01','Value02'}, Code04 = {'Value15'}>}distinct ACCOUNT)

Count ({$<Year = {$(=max(MaxYear))}, Code1 = {'Value03'}, Code2 = {'Value05'},  Code3  = {'Value09'}, Code04 = {'Value15'}>}distinct ACCOUNT)

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

Count( {$<Year = {$(=max(MaxYear))}, Code1 = {'Value01','Value02'}, Code04 = {'Value15'}> + <Year = {$(=max(MaxYear))}, Code1 = {'Value03'}, Code2 = {'Value05'},  Code3  = {'Value09'}, Code04 = {'Value15'}>}distinct ACCOUNT)


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

Count( {$<Year = {$(=max(MaxYear))}, Code1 = {'Value01','Value02'}, Code04 = {'Value15'}> + <Year = {$(=max(MaxYear))}, Code1 = {'Value03'}, Code2 = {'Value05'},  Code3  = {'Value09'}, Code04 = {'Value15'}>}distinct ACCOUNT)


talk is cheap, supply exceeds demand
Not applicable
Author

Perfect!  Worked like a charm.  Thanks so much.