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: 
peschu123
Partner - Creator III
Partner - Creator III

Strange behavior of (possible)count()

Hi,

on the screenshot you can see which functions I use and below of each function the result:

count.jpg

The variable vReduceSelection contains the string Fleet Type.

I wonder why Getpossiblecount and Count(Distinct Total ... ) gives me a different result...Or why GetpossibleCount gives me no result? And why Count(Distinct Total ) (with vaiable) gives me a result, but obviously not the correct one.

I would appreciate if someone has an explanation for this behavior.

Best Regards,

Peter

2 Replies
jvitantonio
Specialist III
Specialist III

Hello,

Please try like this:

COUNT(DISTINCT TOTAL [$(vReduceSelection])

JV

hic
Former Employee
Former Employee

Because the variable expansion is made as a text, as a string. And not as a field reference. See picture and you'll understand.

VarExpansion.png

The chart label shows how I have written the first expression. The second expression is written the same way, but with the Only() function. The third column is written without any concatenation or quotes, and then it is correctly interpreted as a field reference.

The column headers show how what I have written is interpreted by the calculation engine. Obviously column 1 and 2 are interpreted as strings and not as a field reference. But the third one is interpreted as a field reference.

HIC