Skip to main content

NullCount - script function

NullCount() returns the number of NULL values aggregated in the expression, as defined by a group by clause.

Syntax:  

NullCount ( [ distinct ] expr)

Return data type: integer

Arguments:  

NullCount arguments
Argument Description
expr The expression or field containing the data to be measured.
distinct If the word distinct occurs before the expression, all duplicates are disregarded.

Examples and results:  

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in our document to see the result.

Examples and results
Example Result

Set NULLINTERPRET = NULL;

Temp:

LOAD * inline [

Customer|Product|OrderNumber|UnitSales|CustomerID

Astrida|AA|1|10|1

Astrida|AA|7|18|1

Astrida|BB|4|9|1

Astrida|CC|6|2|1

Betacab|AA|5|4|2

Betacab|BB|2|5|2

Betacab|DD|||

Canutility|AA|3|8|

Canutility|CC|NULL||

] (delimiter is '|');

Set NULLINTERPRET=;

NullCount1:

LOAD Customer,NullCount(OrderNumber) as NullOrdersByCustomer Resident Temp Group By Customer;

 

LOAD NullCount(OrderNumber) as TotalNullCount Resident Temp;

Customer NullOrdersByCustomer

Astrida 0

Betacab 0

Canutility 1

 

The second statement gives:

TotalNullCount

1

in a table with that dimension, because only one record contains a null value.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com