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: 
Anonymous
Not applicable

COUNT() used in expression

Hi,

I have a COUNT() statement which looks like this in one of the expressions for a chart:

count ( {<Col1_in_Table1={1}>} DISTINCT Col2_in_Table2 )

Can someone let me know if I’m interpreting this statement correctly or not. 

So if my data looks like this:

Col1_in_Table1

Col2_in_Table2

1

X

1

X

1

Y

0

X

0

X

Does the COUNT() in above return 2?

Thank you.

11 Replies
swuehl
MVP
MVP

Yes, two distinct Col2_in_Table2 values X and Y where Col1_in_Table1 equals 1.

But are the two columns really located in a single table or two?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

That's correct if you use this expression in, say a text box or a chart or straight table without dimensions.

If you do apply dimensions to your expression, the dimension values may further reduce the result of this expression.

Best,

Peter

miguelbraga
Partner - Specialist III
Partner - Specialist III

Yes it returns 2

Sem Título.png

Regards,

MB

Anonymous
Not applicable
Author

Thanks.  There are two tables involved here.

Anonymous
Not applicable
Author

Thank you for the quick replies.

Just wanted to make sure I understand the syntax as i'm troubleshooting an app that was written by someone else.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Moreover, as Stefan already indicated, the location may have an impact as well. You seem to place Col1 in Table1 and Col2 in Table2. Two separate tables then. How are rows in each table associated? No association will still return 2 as long as you do not select anything in Col2.

miguelbraga
Partner - Specialist III
Partner - Specialist III

Do you need my qvw? If not, does my answer gave you what you need? If so put it as the correct answer Have nice job.

Regards,

MB

Anonymous
Not applicable
Author

Hi Peter,

Yes, there's another column which links these two tables.  I just gave a very simplied example but thanks for

pointing this out.

Anonymous
Not applicable
Author

Hi Miguel,

Please post your qvw.  QV is new to me.

Thanks