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

getpossiblecount() to also count Nulls

Hi

Getpossiblecount() returns the current number of possible values in a field, however since null is not value per se it is not included in the count.

How can one get a count of possible values, including null ?

Best Regards,     Bill

1 Solution

Accepted Solutions
tresesco
MVP
MVP

A trick just hits mind. Null count would be always one, right? May be you can add 1 to count conditionally like:

=If(Index(Field,null()),GetPossibleCount(Field)+1,GetPossibleCount(Field))

Or,

Simply like:

NullCount( Distinct Field)+GetPossibleCount(Field)

View solution in original post

4 Replies
MK_QSL
MVP
MVP

have you tried NullCount function ?

tresesco
MVP
MVP

A trick just hits mind. Null count would be always one, right? May be you can add 1 to count conditionally like:

=If(Index(Field,null()),GetPossibleCount(Field)+1,GetPossibleCount(Field))

Or,

Simply like:

NullCount( Distinct Field)+GetPossibleCount(Field)

Roop
Specialist
Specialist

If you wish to count the null values you can probably do this some other way.

If they are a field in a fact table, you cannot really know whether each null is unique or not. If the nulls are in a reference table there must be some lind of other field for reference to count.

In either case it is quite often easier to add a field to the table with the content of 1 and then use sum ....

I hope this is useful

Anonymous
Not applicable
Author

NullCount( Distinct Field)+GetPossibleCount(Field) works perfectly.


Many Thanks,     Bill