Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

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
MVP
MVP

Re: getpossiblecount() to also count Nulls

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)

4 Replies

Re: getpossiblecount() to also count Nulls

have you tried NullCount function ?

MVP
MVP

Re: getpossiblecount() to also count Nulls

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)

rupe
Valued Contributor

Re: getpossiblecount() to also count Nulls

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

Re: getpossiblecount() to also count Nulls

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


Many Thanks,     Bill

Community Browser